简体   繁体   中英

Will “composer install” update vendor files after composer.lock file is modified?

Let's say that multiple people are working on the same project where vendor files are maintained with composer. Person A runs:

composer update

command to update dependencies to its latest versions and stores the changes into the composer.lock file.

A now pushes composer.lock file and person B pulls it from the repository.

Now B has the updated composer.lock file, but outdated vendor files.

What should B do to update vendor files to version stored in the new composer.lock file?

Will composer install check for versions of vendor files and compare them with versions stored inside composer.lock and update outdated files?

Or is it necessary to manually delete all vendor files before running composer install ?

Running composer install on an application with an existing vendor directory will cause packages to be updated (packages installed, updated and removed) so the vendor directory matches what's declared on the lock file.

Personally, if I'm running install I'll delete vendor contents anyway.

But that's just to make sure I'm not missing anything, and no unexpected artefact as the autoloader files or anything like that is left behind.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM