Specifying the supported version of Composer in composer.json #9625
-
Hi all, I'm gradually rolling out Composer 2 to our PHP projects at work and I'm trying to find a way to declare the supported version of Composer itself in composer.json. That way we can more easily keep an overview of what projects still need to be updated. Is it good practice to do this by adding |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
if you want to force using composer 2, you can add a requirement on Depending on |
Beta Was this translation helpful? Give feedback.
if you want to force using composer 2, you can add a requirement on
composer-runtime-api: ^2
. There is no equivalent way to force using composer 1 as there is nocomposer-runtime-api
package in v1.Depending on
composer/composer
as a dependency will not lock the version of composer being run. It will install the code of composer in your vendor folder when running composer. But that code installed there won't be used to run composer (that's too late anyway).