In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how composer updates the specified dependency package, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Composer updates the specified dependency package
Compoesr's require/update can update specified dependency packages (upgrade / downgrade).
Require is more flexible, installing if not installed and upgrading or downgrading based on the version number passed in.
Update cannot pass in the specified version number on the command line. You need to manually edit composer.json, specify a new version number, and then execute the update command.
# ignore composer require google/protobuf-- ignore-platform-reqs-vvvrequire command
Example
/ / installation package composer require hashids/hashids:2.0.0// installed upgrade composer require hashids/hashids:3.0.0// installed degraded composer require hashids/hashids:2.0.4update command
The update command cannot specify the package version number on the command line and needs to modify the composer.json file manually
/ / install package composer require hashids/hashids:2.0.0
Misuse
Composer update hashids/hashids:3.0.0
Examples of correct usage
Vim composer.json "require": {"hashids/hashids": "3.0.0"},: wq# upgrade to 3.0.0composer update hashids/hashidsvim composer.json "require": {"hashids/hashids": "2.0.4"},: wq# downgraded to 2.0.4composer update hashids/hashids
At the same time, if we edit the version numbers of multiple packages, we cannot use the
Composer update package1
Composer update package2
Composer update package3
Because composer will check the integrity of the configuration file json vs lock, you specify that I update A, but your B version is inconsistent in json and lock, but you do not want me to update it, this is a problem.
At this time, you can only use the composer update global update dependency. Note that it is the update operation of the global package. Some packages that you have not changed but use the scope of the version number may also be updated and upgraded, please use with caution!
Install command
Install can be used for initial installation dependency after project initialization, and the version number in composer.lock will be read first to ensure the consistency of package versions in collaborative development as much as possible.
The package version record stored in composer.lock is equivalent to executing composer require packageName:versionNo, and what is not stored is equivalent to executing composer update packageName with versionRule in composer.json.
When we collaborate on development, An installs a new dependency package locally, or updates the dependency package, which will be written into composer.lock/composer.json,An and uploaded to the repository. After B pulls it locally, a composer install should be executed to synchronize the team's version changes.
So in collaborative development, we recommend uploading composer.lock/composer.json to the remote repository at the same time.
The version number range is greater / greater than or equal to: > 1.2.3 > = 1.2.3 less than / less than or equal to:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.