1

Let's say we have two packages A and B, with the same dependency C but they require two different versions of C (1 and 2 respectively).

If we require in both libraries A and B in the same request and thus both C.1 and C.2 get included in the autoloader. Then when we use B, it could potentially use C version 1 instead of what it should use: C version 2.

Milind Chavan
  • 99
  • 1
  • 2
  • 6
  • 1
    How did you end up in that situation? Normally, Composer will not install two versions of the same package. – xabbuh Oct 19 '18 at 09:12
  • I am using AWS3.56.0 package and it needs dependency guzzlehttp/psr7 1.4.2 and now I am trying to install google/apiclient package and it needs dependencies guzzlehttp/psr7 1.2, so in this scenario the composer is not able to install google/apiclient, how do I deal with this ? – Milind Chavan Oct 31 '18 at 06:41
  • I search on the internet and come across the term 'Dependency Hell' how to avoid or resolve it? coz nowadays everyone is using composer to manage dependencies. Could you please help me with this. – Milind Chavan Oct 31 '18 at 07:01
  • Looking at the constraints for `google/apiclient` that package should allow more recent versions of `guzzlehttp/psr7` too. What exact steps did you perform and what error messages did you get? – xabbuh Oct 31 '18 at 18:15
  • 1
    This question has beed already answered here https://stackoverflow.com/questions/27150695/how-does-composer-handle-multiple-versions-of-the-same-package/27153452 – brutto Apr 29 '20 at 11:58
  • Does this answer your question? [How does composer handle multiple versions of the same package?](https://stackoverflow.com/questions/27150695/how-does-composer-handle-multiple-versions-of-the-same-package) – yivi Apr 19 '22 at 06:23

0 Answers0