I have this laravel project, but due the specific version of it’s dependencies it need php 8 to run, but I need it to run with php 7.4, is there a way so that we can downgrade the dependencies?
....
"require": {
"php": "^8.0.2",
"barryvdh/laravel-debugbar": "^3.6",
"fruitcake/laravel-cors": "^2.0.5",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^9.0",
"laravel/sanctum": "^2.14",
"laravel/tinker": "^2.7",
"laravel/ui": "^3.4",
"laravelcollective/html": "^6.3"
},
"require-dev": {
"brianium/paratest": "^6.4",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"pestphp/pest-plugin-laravel": "^1.2",
"pestphp/pest-plugin-parallel": "^1.0",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
...
Note: So far I could only found that manually searching for proper version compatible to php 7.4 and adjust it inside composer.json manually is an option.
3
Answers
I recently did the same to one of my projects, so I did it like so
composer.lock
but I think you can actually skip this step;composer install
;Laravel 9 works only on PHP 8, so you can’t, unless you are up to downgrading Laravel version too. But installing newer PHP will be faster.
Laravel 9 works on > php8 so you can’t downgrade php version to 7.4
laravel support policy