compoesr
#/
updatecan update the specified dependency package (upgrade/downgrade).
requireis more flexible. If it is not installed, it will be installed. If it is installed, it will
upgradeor
downgradeaccording to the passed version number.
updatecannot pass the specified
version numberon the command line. You need to manually edit
composer.jsonfirst and specify the new
version number., and then execute the update command.
#忽略 composer require google/protobuf --ignore-platform-reqs -vvv
// 安装包 composer require hashids/hashids:2.0.0 // 已安装 升级 composer require hashids/hashids:3.0.0 // 已安装 降级 composer require hashids/hashids:2.0.4
updatecommand Unable to specify
package version on the command line No., you need to manually modify the
composer.jsonfile
// 安装包 composer require hashids/hashids:2.0.0
composer update hashids/hashids:3.0.0
vim composer.json "require": { "hashids/hashids": "3.0.0" }, :wq #升级到3.0.0 composer update hashids/hashids vim composer.json "require": { "hashids/hashids": "2.0.4" }, :wq #降级到2.0.4 composer update hashids/hashids
composer update package1
composer update package2
composer update package3method to update sequentially, because
composerwill verify the integrity of the configuration file
json vs lock, you specified that you want me to update
A, but you
B's
versionis inconsistent in
jsonand
lock, but you don't want me to update it. This is problematic.
composer updateto update dependencies globally. Note that it is an update operation for global packages. Some packages that you have not changed but use a version number range may also be updated and upgraded. Please Use with caution!
installcan be used to install dependencies for the first time after the project is initialized, and the version number in
composer.lockwill be read first , to ensure the consistency of package versions in collaborative development as much as possible. The package version record that exists in
composer.lockis equivalent to executing
composer require packageName:versionNo, and the one that does not exist is equivalent to executing
composer update packageName with versionRule in composer.json.
composer.lock/composer.json, and A uploads it to the warehouse. After B is pulled to the local,
composer installshould be executed once to synchronize the team's version changes.
composer.lock/composer.jsonto the remote warehouse at the same time.
大于/大于等于:>1.2.3 >=1.2.3 小于/小于等于:<1.2.3 <=1.2.3 确切的版本号:1.2.3 ~1.2.3: 1.2.3 <= version < 1.3 ^1.2.3: 1.2.3 <= version < 2.0 { "php": ">=7.0", "ext-swoole": ">=4.0.0", "lib-curl": ">=7.29.0" }
Copy after login
大于/大于等于:>1.2.3 >=1.2.3 小于/小于等于:<1.2.3 <=1.2.3 确切的版本号:1.2.3 ~1.2.3: 1.2.3 <= version < 1.3 ^1.2.3: 1.2.3 <= version < 2.0 { "php": ">=7.0", "ext-swoole": ">=4.0.0", "lib-curl": ">=7.29.0" }