Home>Article>Development Tools> Composer experience sharing: summary of the use of install and update

Composer experience sharing: summary of the use of install and update

藏色散人
藏色散人 forward
2021-09-21 17:32:03 2702browse

This article is provided by the tutorial column ofcomposerto introduce you to the experience of using composer install and update. I hope it will be helpful to friends in need!

Composer experience sharing: summary of the use of install and update

#Installinstall

composer installreads third-party components and their versions fromcomposer.lockand installs them into thevendordirectory.If the
composer.lockfile does not exist, read thecomposer.jsonthird-party component and its version, and then install it in thevendordirectory.

Updateupdate

updateobtains third-party components and components directly fromcomposer.jsonits version and then update thecomposer.lockfile.If the dependent third-party component has a version update,
updatewill install the latest version into thevendordirectory and updatecomposer.lock.

Usage experience

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

composer updatecommand because it may be used during the testing phase. version of the third-party component library, thecomposer updatecommand was executed during online packaging, resulting in the problem of third-party component updates being released directly without testing.

The recommended approach is to add both

composer.jsonandcomposer.lockto the version management process, and pay attention during the development process# For changes in dependent versions in ##composer.lock, usecomposer installfor each online package to obtain dependent third-party components and versions fromcomposer.lock.If you need to update third-party components, when executing the

composer update

command,should be appended with the component librarythat needs to be updated.

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

The above is the detailed content of Composer experience sharing: summary of the use of 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