Reputation: 3194
I have a package that I have installed through composer that required guzzlehttp >=6.0
. With that requirement, composer chose to install 6.2.1.
I am now trying to require a dependency that explicitly requires 6.1.1.
I get the following error:
Problem 1
- Can only install one of: guzzlehttp/guzzle[6.1.1, 6.2.1].
- Can only install one of: guzzlehttp/guzzle[6.2.1, 6.1.1].
- Can only install one of: guzzlehttp/guzzle[6.1.1, 6.2.1].
- chargely/chargify-sdk-php v0.1.1 requires guzzlehttp/guzzle 6.1.1 -> satisfiable by guzzlehttp/guzzle[6.1.1].
- Installation request for chargely/chargify-sdk-php ^0.1.1 -> satisfiable by chargely/chargify-sdk-php[v0.1.1].
- Installation request for guzzlehttp/guzzle (locked at 6.2.1) -> satisfiable by guzzlehttp/guzzle[6.2.1].
Also, composer why
confirms that the only that version of guzzle is there is because of my >=6.0
requirement.
In theory, that initial requirement should be OK with using a downgraded version of guzzle. How do I get composer to do that?
Upvotes: 6
Views: 19937
Reputation: 353
Simply "require" the correct version of the dependency, add the new package and then remove the hard-coded version constraint.
Summary (For a vendor/current
with a constraint of vendor/dependency:"^1.0|^2.0")
composer require vendor/dependency:^1.0
composer require vendor/new
composer remove vendor/dependency
e.g.
vendor/current
with a constraint of vendor/dependency:"^1.0|^2.0"
vendor/dependency:2.x
vendor/new
with constraint of vendor/dependency:"^1.0"
=> FAIL (as you already have a too high installed vendor/dependency (of 2.0)composer require vendor/dependency:^1.0
composer require vendor/new
composer remove vendor/dependency
Upvotes: 0
Reputation: 24298
If you have 2 packages with concurrency requirements, you can go around with aliasing.
In your composer.json
, just add:
"require": {
"guzzlehttp/guzzle": "6.2 as 6.1"
}
Then add new package with composer require ...
.
Go check more detailed answer for more.
Upvotes: 10