Skip to main content

Force Composer to use a specific PHP version

to Force the composer to use a specific PHP version you can add this script to the composer.josn

	"config": {
		"optimize-autoloader": true,
		"prepend-autoloader": false,
		"platform": {
			"php": "8.0.13"
		}
	},

or you can use the command line to add it 

cd /path/to/project/dir
ls -l composer.json
composer config platform.php {PHP_VERSION_HERE}
composer config platform.php 8.x.x

Tags