JeanneD4RK
JeanneD4RK

Reputation: 333

Composer won't install package despite dependencies are satisfied

I am trying to create a small proxy for a specific purpose. I chose to use the following project : https://github.com/jenssegers/php-proxy

I get the following error when trying to install it using composer :

~# > php composer require jenssegers/proxy
Using version ^2.2 for jenssegers/proxy
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install jenssegers/proxy v2.2.1
    - Conclusion: remove symfony/http-foundation v4.0.8
    - Installation request for jenssegers/proxy ^2.2 -> satisfiable by jenssegers/proxy[v2.2.0, v2.2.1].
    - Conclusion: don't install symfony/http-foundation v4.0.8
    - jenssegers/proxy v2.2.0 requires symfony/http-foundation ~2.6 -> satisfiable by symfony/http-foundation[v2.6.0, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.40, v2.7.41, v2.7.42, v2.7.43, v2.7.44, v2.7.45, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.33, v2.8.34, v2.8.35, v2.8.36, v2.8.37, v2.8.38, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9].
    - Can only install one of: symfony/http-foundation[v2.6.0, v4.0.8].
    [...]
    - Can only install one of: symfony/http-foundation[v2.8.9, v4.0.8].
    - Installation request for symfony/http-foundation (locked at v4.0.8) -> satisfiable by symfony/http-foundation[v4.0.8].


Installation failed, reverting ./composer.json to its original content.

My problem is, I have http-foundation v4.0.8 :

~# > php composer show symfony/http-foundation
name     : symfony/http-foundation
descrip. : Symfony HttpFoundation Component
keywords :
versions : * v4.0.8
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/symfony/http-foundation.git d0864a82e5891ab61d31eecbaa48bed5a09b8e6c
dist     : [zip] https://api.github.com/repos/symfony/http-foundation/zipball/d0864a82e5891ab61d31eecbaa48bed5a09b8e6c d0864a82e5891ab61d31eecbaa48bed5a09b8e6c
names    : symfony/http-foundation

autoload
psr-4
Symfony\Component\HttpFoundation\ => .
exclude-from-classmap

requires
php ^7.1.3
symfony/polyfill-mbstring ~1.1

requires (dev)
symfony/expression-language ~3.4|~4.0

Is there any reason Composer won't install my package ?

Thanks

Upvotes: 0

Views: 1966

Answers (2)

JeanneD4RK
JeanneD4RK

Reputation: 333

NOT A SOLVE BUT A WORKAROUND

I created my own class in src/Utils/Proxy.php using this : http://php.net/manual/en/book.curl.php#90821

Works as expected (I still have to rewrite all the webpage links to be proxified themselves)

Thanks for the answer Tomáš Votruba

Upvotes: 1

Tomas Votruba
Tomas Votruba

Reputation: 24280

In this kind of error I always look for requires word. In your case:

jenssegers/proxy v2.2.0 requires symfony/http-foundation ~2.6

That means you need to have symfony/http-foundation ~2.6 first to meet this condition.

Also locked at v4.0.8 means that composer.lock locked this value.

How to solve it?

  • delete composer.lock
  • composer remove symfony/http-foundation
  • composer require jenssegers/proxy
  • if it fails, see what other packages are in conflict looking for requires keyword

Going Deeper

When I look at the package on Github (https://github.com/jenssegers/php-proxy), I see it was not released for over 2 years. Last release was v3.0.0-beta2 in October 2017.

Personally, I'd rather fork this package, release own version with Symfony 4 support, or contact the maintainer for release 3.0 stable that is Symfony independent.

Upvotes: 4

Related Questions