change php version of laravel project code example

Example 1: update php version in laravel

"config": {
    "platform": {
        "php": "7.0.7"
    },
    "preferred-install": "dist",
    "optimize-autoloader": true
}

run composer install

Example 2: i installed laravel 7.2.4 version but it shows php v 7.2

I've had this problem too. If you don't want to update all your composer
packages, you can solve this issue by manually changing the composer.lock file 
and writing your actual PHP version in platform > php in the JSON object.

Example

...
"platform": {
    "php": "7.1"
}
...
Although it works, the most recommended way to do this would be deleting your 
composer.lock file, changing the platform > php version in composer.json and 
then executing composer install

Tags:

Php Example