Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow Composer to downgrade a dependency on require?

Tags:

composer-php

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?

like image 946
Narcissus Avatar asked Sep 16 '16 17:09

Narcissus


1 Answers

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.

like image 79
Tomas Votruba Avatar answered Oct 20 '22 02:10

Tomas Votruba