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

藏色散人
Release: 2021-09-21 17:32:03
forward
2776 people have browsed it

This article is provided by the tutorial column of composer to 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 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.

Updateupdate

update obtains third-party components and components directly from composer.json its version and then update the composer.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 it may be used during the testing phase. version of the third-party component library, the composer update command 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.json and composer.lock to the version management process, and pay attention during the development process# For changes in dependent versions in ##composer.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 Composer experience sharing: summary of the use of install and update. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!