Resolving Dependency Hell with Composer
-
11-12-2019 - |
Question
This is the scenario.
You have package A and package B in your composer.json (your app depends on this 2 packages).
Both package A and B depend on package C, but on different versions. Say A depend on C v2.1, and B depends on C v2.2.
And you get version conflicts.
Both A, B and C are third party packages.
How to resolve this?
Solution
This is a hack but will probably let you move forward.
You could overwrite repositories for "A", "B" and "C" packages and make that "A" and "B" rely on the same version of "C" (actually, might be that it's enough to overwrite repositories for "A" and "B" only).
This should work as long as both "A" and "B" can work with the latest version of "C" (so probably a maintainer didn't update the package version). If it's the case I'd also consider sending a pull request to the project which has an older version of a dependency.
OTHER TIPS
We are discussing it in this mailing list : http://news.php.net/php.internals/72594
"No-conflict" technique must be implemented in PHP , it's not a composer fault