在实际的项目开发中,有的旧项目用的是 composer
旧版本,而新项目需要使用 composer2
,这里涉及到升级降级的问题,参考下面:
升级到 composer2
(base) PS C:\laragon\composer> composer self-update --2
Updating to version 2.7.8 (2.x channel).
Downloading (100%)
Use composer self-update --rollback to return to version 1.10.26
(base) PS C:\laragon\composer> composer -v
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 2.7.8 2024-08-22 15:28:36
降级
PS C:\laragon\composer> composer self-update --1
Warning: You forced the install of 1.10.27 via --1, but 2.7.8 is the latest stable version. Updating to it via composer self-update --stable is recommended.
Upgrading to version 1.10.27 (1.x channel).
Use composer self-update --rollback to return to version 2.7.8
这样就强制降级到版本1了。