148

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
7
  • 2
    stackoverflow.com/questions/32838881/… My question is different from this because I have a higher version than it required. Dec 26, 2020 at 9:08
  • Yes, but you can also simulate platforms as mentioned in the answer there.
    – nice_dev
    Dec 26, 2020 at 9:15
  • 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. Feb 10, 2021 at 9:48
  • 6
    'composer install --ignore-platform-reqs' also you may use.it might work in your case. Aug 28, 2021 at 18:25
  • 1
    Further reading about writing version constraints.
    – Pathros
    Mar 7, 2022 at 22:20

1 Answer 1

282

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",
    .....
},
10

Not the answer you're looking for? Browse other questions tagged or ask your own question.