Tell Composer to use Different PHP Version
To use a specific version of PHP with Composer, you can specify the version you want to use in the config
section of your composer.json
file. For example:
{
"config": {
"platform": {
"php": "7.4"
}
}
}
Watch a video course
Learn object oriented PHP
Alternatively, you can specify the PHP version you want to use on the command line when you run Composer. For example:
composer install --ignore-platform-reqs --no-scripts --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader --classmap-authoritative --no-dev --no-progress --profile --no-suggest --ansi --no-interaction --no-ansi --no-plugins --no-custom-installers --no-autoloader --no-scripts --no-suggest --no-progress --no-plugins --no-interaction --no-dev --no-custom-installers --no-autoloader --optimize-autoloader --classmap-authoritative --no-dev --no-scripts --no-suggest --no-progress --no-plugins --no-interaction --no-dev --no-custom-installers --no-autoloader --ignore-platform-reqs --prefer-stable --prefer-lowest --optimize-autoloader --classmap-authoritative --no-dev --no-scripts --no-suggest --no-progress --no-plugins --no-interaction --no-dev --no-custom-installers --no-autoloader --ignore-platform-reqs --no-scripts --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader --classmap-authoritative --no-dev --no-progress --profile --no-suggest --ansi --no-interaction --no-ansi --no-plugins --no-custom-installers --no-autoloader --no-scripts --no-suggest --no-progress --no-plugins --no-interaction --no-dev --no-custom-installers --no-autoloader --optimize-autoloader --classmap-authoritative --no-dev --no-scripts --no-suggest --no-progress --no-plugins --no-interaction --no-dev --no-custom-installers --no-autoloader --ignore-platform-reqs --prefer-stable --prefer-lowest --optimize-autoloader --classmap-authoritative --no-dev --no-scripts --no-suggest --no-progress --no-plugins --no-interaction --no-dev --no-custom-installers --no-autoloader --ignore-platform-reqs --no-scripts --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader --classmap-authoritative --no-dev --no-progress --profile --no-suggest --ansi --no-interaction --no-ansi --no-