Skip composer PHP requirement

I’ve found the option:

composer install --ignore-platform-reqs

Ignore platform requirements (php & ext- packages).


Alternative: Specify your projects’ PHP version

You can skip the platform checks by configuring composer.json#/config/platform/php with the PHP version to use.

Composer will fetch packages based on that configured PHP version then.

So when you need to tell Composer the PHP version for your projects dependencies, you can (and should) specify the PHP version if different than the PHP version you execute composer with in your composer.json project configuration file (AKA root package):

{
    "config": {
       "platform": {
           "php": "5.6.6"
       }
    }
}

Here PHP 5.6.6 version is exemplary, it could be 8.0.4 or any other PHP version.

This also documents the target (platform) PHP configuration. Additionally installed PHP extensions and library versions can be specified.

Compare: Config: platform – Composer documentation

Leave a Comment