Simple explanation:
- Composer Install: If you have the Composer.lock file, install it directly. Otherwise, install the latest extension package and dependencies from Composer.json.
- Composer Update: Install the latest extension package and dependencies from composer.json;
- Composer Update Vendor/Package: From the configuration of composer.json or the corresponding package, and updated to the latest;
- Composer require new/package ~2.5 Composer require new/package ~2.5 Composer require new/package ~2.5
Process used in the development project:
I. New project process:
- Create composer.json and add the extension package to which you depend.
- Run Composer Install, install the extension package, and generate Composer.lock;
- Commit composer.lock to a code version controller such as git;
II. Project collaborators pull the project:
After cloning the project, run composer install directly from the root directory to install the specified version of the extension package and its dependencies from Composer.lock;
Add a new extension pack to the project:
- Add extension packages using Composer require new/package;
- Commit the updated composer.json and composer.lock to the code version controller, such as git;
Reference:
- composer install https://docs.phpcomposer.com/…
- composer update https://docs.phpcomposer.com/…