Usage problems in composer work

offline development projects need to use new libraries, so require
also local composer.json , composer.lock are updated, so push these two files online (online composer install has installed dependencies). What command should I use to install a new local library online at this time?
require ? install ? update ?

Apr.02,2021

composer install
is fine

as long as you upload the composer.lock file, install the dependent libraries of the online environment directly with composer install , which ensures that the versions of the dependencies in the online and local dependent libraries are exactly the same. And directly using composer install will save the time of analyzing dependencies, and it will be very fast to download and install dependent libraries directly.

online production environments should avoid using the composer update, composer update command to update dependent versions and not guarantee full compatibility with previous code.


Thank you for the invitation.
composer.json is the configuration file for composer. Composer.lock is a composer locked version of the file, you need to use a fixed version to upload this file. The
composer require command downloads the dependent library you want separately, and automatically handles other libraries related to the dependent library.
composer install will first download the dependent library according to the composer.lock file, and if there is no composer.lock, download the dependent library according to composer.json.
composer update downloads dependent libraries based on composer.json and updates the composer.lock file.


composer update


not running is the answer to @ cabbage 1031 , composer install , and composer update use

carefully.
Menu