Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0"

Follow this trick

  1. add this line in config object of composer.json file

    "platform-check": false

  2. run php artisan config:cache

  3. then run composer dump-autoload in terminal


Project or global composer.json file

{

"config": {

    "platform-check": false
}

}

Problem:


Your composer checks the platform requirements (PHP version and loaded extensions) when the autoloader is loaded. If you run the application which does not meet the platform requirements, the application will exit with a message similar to this:

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.3.0".

Solution:


You could use the easiest way: add --ignore-platform-reqs option to composer install/composer update to ignore all platform requirements.


This worked for me:

sudo a2dismod php7.2
sudo a2enmod php7.4
sudo service apache2 restart

Adjust php7.2 to your current module


Actually, this was the only solution that worked for me:

composer global update
composer dump-autoload

If you're like me who had to downgrade the PHP version on your machine (Mac) due to a specific reason and when you run valet use php --force, you see the Composer global dependencies require PHP v7.3.0 or higher, then you're in the right place. You can comment out the following three lines temporarily and that shall fix the issue for you when running valet use php --force again.

Path: ~/.composer/vendor/composer/platform_check.php

if (!(PHP_VERSION_ID >= 70300)) {
    $issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
}

Note: don't forget to uncomment the relevant three lines after you switch to the latest version of PHP.


@Hashmat Waziri's answer is right but if anybody want to use your plate form's version Either Composer require anything, He can set the code depending on his system, in to composer.json file like->

"config": {
    "platform": {
        "php": "7.1.0"
     }
}