Now that PHP 8.2 has been released, it's time to upgrade the PHP of your Mac.
If you're using Brew - which you probably are - there are only a few steps involved.
Issue these commands
# let's make sure brew is up to date brew update # install php brew tap shivammathur/php brew install email@example.com
That's it! You can check the version of PHP you are running with this command.
This should output PHP 8.2.
Upgrading Laravel Valet
Here are some extra steps for Laravel Valet users to ensure you run your local websites on PHP 8.2.
I've noticed that Laravel Valet will not immediately pick up on the installed PHP 8.2
To upgrade, I ensured I was running the latest version of Valet.
composer global update
Next, you can force Valet to switch to firstname.lastname@example.org using this command.
valet use email@example.com --force
If you now add
phpinfo() to one of your hosted sites, it should output PHP 8.2
And that's all there is to it!
EDIT: I haven't tested this but apparantly Laravel Valet users can upgrade to PHP 8.2 by issuing a single command.
FYI 8.2 will be pulled in automatically if you issue the “valet use firstname.lastname@example.org” command.— Jeff Hansen (@jeffwhansen) December 12, 2022