Appearance
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:
How to make Composer use a different PHP version?
json
{
"name": "example/project",
"require": {},
"config": {
"platform": {
"php": "7.4"
}
}
}
<div class="alert alert-info flex not-prose">Watch a video course Learn object oriented PHP
</div>
Alternatively, you can specify the PHP version you want to use on the command line when you run Composer. For example:
console
composer config platform.php 7.4