1.composer Install
The install command reads the Composer.json file from the current directory, processes the dependencies, and installs them into the vendor directory.
PHP Composer.phar Install
If there is a Composer.lock file in the current directory, it will read the dependent version from this file instead of relying on the Composer.json file. This ensures that each user of the library gets the same dependent version.
If there is no Composer.lock file, composer creates it after the dependency is processed.
2.composer Update
To get the latest version of the dependency and upgrade the Composer.lock file, you should use the Update command.
PHP Composer.phar Update
This resolves all dependencies on the project and writes the exact version number to the Composer.lock.
If you just want to update a few packages, you can list them separately like this:
PHP Composer.phar Update Vendor/package Vendor/package2
You can also use wildcard characters for batch updates:
PHP Composer.phar Update vendor/*
Difference:
Composer Install Command (primary) for the production environment, Composer.lock files record the current version of the project information, and when the install command is executed, each extension of the lock file is detected
The version differs from the latest version, and if so, it is updated to the latest version. The composer Update command does the same, but if you add libraries to the Require field in the Composer.json file,
You must use the composer Update command. However, the contents of other libraries are updated, and if you just add a library without updating other libraries (for example, a production environment), you will use the composer
Require the "package name: Version number" command. Composer Init--require= package Name: Version number-n can also automatically update Composer.json files.
A little humble opinion, the expression is not too good, hope to see Daniel can be supplemented to deepen understanding.