If you are looking to switch your version of PHP in Laravel Valet then you are in luck! There is one simple command you can run to make this happen!
valet use [email protected] valet use php // latest version
It’s really that simple. It’s in the official docs if you’re interested.
If this doesn’t work for you, it is probably because you aren’t on the latest version of Laravel Valet.
To update your version of Valet, just run a global composer update
composer global update
Then you can check your valet version to make sure it’s at least
I believe the “valet use [email protected]” command was added around 2.2.x so make sure you are on at least that version.
Update PHP via Homebrew
One thing you may want to do when doing this is update your PHP versions to the latest. For example, when I ran “valet use php” and checked my PHP version, I was on 7.3.0.
As of this writing, the current version of PHP is 7.3.8. To get this updated just type the following
brew upgrade php
If you want to upgrade other versions, just use “brew upgrade [email protected]” or whatever other version you need.
Problems with Tinker on PHP 7.3?
If this is your first time using PHP 7.3 and you use php artisan tinker a lot like I do, you’ll soon realize tinker doesn’t work.
Tinker loads, but then when you try to type anything it just quits without warning.
If you want to fix this, check out my article for Fixing Laravel Tinker on PHP 7.3