142

I have an unusual error while running the composer install command.

It requires PHP 7.3 while I have PHP 8.0.0. This question is different from Override PHP base dependency in composer, because I have a higher version of PHP (8.0.0) than it required. Why is it not working?

Problem 1
    - Root composer.json requires php ^7.3 but your php version (8.0.0) does not satisfy that requirement.         Problem 2
    - asm89/stack-cors is locked to version v2.0.1 and an update of this package was not requested.
    - asm89/stack-cors v2.0.1 requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.   Problem 3
    - laravel/framework is locked to version v8.10.0 and an update of this package was not requested.
    - laravel/framework v8.10.0 requires php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.   Problem 4
    - laravel/tinker is locked to version v2.4.2 and an update of this package was not requested.
    - laravel/tinker v2.4.2 requires php ^7.2 -> your php version (8.0.0) does not satisfy that requirement.   Problem 5
    - facade/flare-client-php is locked to version 1.3.6 and an update of this package was not requested.
    - facade/flare-client-php 1.3.6 requires php ^7.1 -> your php version (8.0.0) does not satisfy that requirement.   Problem 6
    - facade/ignition is locked to version 2.4.1 and an update of this package was not requested.
    - facade/ignition 2.4.1 requires php ^7.2.5 -> your php version (8.0.0) does not satisfy that requirement.   Problem 7
    - fzaninotto/faker is locked to version v1.9.1 and an update of this package was not requested.
    - fzaninotto/faker v1.9.1 requires php ^5.3.3 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.   Problem 8
    - nunomaduro/collision is locked to version v5.0.2 and an update of this package was not requested.
    - nunomaduro/collision v5.0.2 requires php ^7.3 -> your php version (8.0.0) does not satisfy that requirement.   Problem 9
    - asm89/stack-cors v2.0.1 requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
    - fruitcake/laravel-cors v2.0.2 requires asm89/stack-cors ^2.0.1 -> satisfiable by asm89/stack-cors[v2.0.1].
    - fruitcake/laravel-cors is locked to version v2.0.2 and an update of this package was not requested.

From the comments its found that the following command will work for some extend. Its also works for my case

composer install --ignore-platform-reqs
NIKHIL NEDIYODATH
  • 2,703
  • 5
  • 24
  • 30
  • 1
    https://stackoverflow.com/questions/32838881/override-php-base-dependency-in-composer My question is different from this because I have a higher version than it required. – NIKHIL NEDIYODATH Dec 26 '20 at 09:08
  • Yes, but you can also simulate platforms as mentioned in the answer there. – nice_dev Dec 26 '20 at 09:15
  • ^7.3 means versions 7.3.0 or upper. However, it is not compatible with version 8 or upper – Jack Ou Jan 05 '21 at 22:11
  • 2
    It depends. Do you work via docker? It means your container have the needed php version. and if you try outside your update and your php version of your OS is higher then you will get this warining. One way to solve this is run composer update with the flag --ignore-platform-reqs. – Maik Lowrey Feb 10 '21 at 09:48
  • 5
    'composer install --ignore-platform-reqs' also you may use.it might work in your case. – Yagnesh bhalala Aug 28 '21 at 18:25
  • This did it for me. Thanks. – hackernewbie Oct 05 '21 at 17:25
  • 1
    Further reading about [writing version constraints](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints). – Pathros Mar 07 '22 at 22:20

1 Answers1

276

It's because in your project in composer.json file you have:

"require": {
    "php": ">=7.3",
    .....
},

Try to update this requirement to:

"require": {
    "php": "^7.3||^8.0",
    .....
},
VirCom
  • 3,414
  • 1
  • 10
  • 10
  • 19
    the double pipe should be used instead of the single one. the single one still works, but just for posterity: https://github.com/composer/composer/issues/6755 – godbout Jan 21 '21 at 16:19
  • 1
    This is not an appropriate solution for this problem. It is not working. You may see the code from here https://prnt.sc/yoo7gw and the error here https://prnt.sc/yoo802 – Md Rasheduzzaman Feb 08 '21 at 04:49
  • I disagree... You have: gabrielbull/ups-api 0.8.0 requires php ^5.5 || ^7.0 -> your php version (8.0.1) does not satisfy that requirement. So you must use php interpreter version 5.5 or 7.0 and above. But you are have 8.0.1. So first of all you must update package gabrielbull/ups-api to version 1.2.0 or above – VirCom Feb 10 '21 at 06:29
  • didn't work for me! Still get the same output. – Fariman Kashani Mar 29 '21 at 07:10
  • 301
    `composer install --ignore-platform-reqs` – Bira Apr 21 '21 at 01:40
  • 3
    More about versions syntax: https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators – Pathros Mar 07 '22 at 22:18
  • 2
    `composer update --no-scripts` – Fawaz Al Romy May 25 '22 at 12:54
  • As a sanity check, also check the PHP version being used: `env php -v` and ensure that it does indeed match what you think it should. – Praj Basnet Jun 02 '22 at 20:15
  • "require": { "php": "^7.3|^8.0", } Update your composer.json like above.. if not works.. try to update composer using *--no-scripts* tag – Jopsy Aug 17 '22 at 05:54
  • For sure those composer errors are anything but clear – Decagrog Feb 21 '23 at 15:55