Home >Development Tools >composer >Share your experience using composer install and update!

Share your experience using composer install and update!

藏色散人
藏色散人forward
2020-07-22 13:19:192971browse

The following is the tutorial column of composer to introduce the experience of using composer install and update. I hope it will be helpful to friends in need!

Share your experience using composer install and update!

#Install

install

composer install reads third-party components and their versions from composer.lock and installs them into the vendor directory. If the
composer.lock file does not exist, read the composer.json third-party component and its version, and then install it in the vendor directory.

Update

update

update is to obtain third-party components and their versions directly from composer.json, and then updatecomposer.lock file. If the dependent third-party component has a version update,
update will install the latest version into the vendor directory and update composer.lock.

Usage experience

In a production environment, it is risky to directly use the

composer update command because there may be versions of third-party component libraries used in the testing phase. , the composer update command was executed during online packaging, causing the problem of third-party component updates being released directly without testing. The recommended approach is to add both
composer.json and composer.lock to the version management process, and pay attention to composer during the development process. For changes in dependent versions in .lock, use composer install for each online package to obtain dependent third-party components and versions from composer.lock. If you need to update third-party components, when executing the
composer update command, should be appended with the component library that needs to be updated.

Reference documentation: https://docs.phpcomposer.com/03-cli.html#install

The above is the detailed content of Share your experience using composer install and update!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete