Sorry. This is stupid advice here. Please don’t follow it 🙂 If your dependencies require different PHP version then change PHP version or change the dependency (to different version). Simple.
I tried to initiate new Laravel project and ran into an error. I have been using php 8.0.2 but Magento needed 7.4 so I switched to 7.4 and now I am having this issue with Composer 🙂
Your Composer dependencies require a PHP version “>= 8.0.2”. You are running 7.4.27.
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.0.2”. You are running 7.4.27. in C:\Users\john\AppData\Roaming\Composer\vendor\composer\platform_check.php on line 24
How to get the value of PHP_VERSION_ID
In terminal run php -a
and then var_dump(PHP_VERSION_ID);
 You should see the id. To exit you can use ctrl+c
.
How to solve it
Open the platform_check.php file and update the PHP_VERSION_ID to what you currently have.
Not sure if it is the best practice but it works.