Today is the official release day for Laravel 9. This release is packed full of goodies. Unfortunately, I've been a slacker about upgrading to PHP 8. If you're like me and still on PHP 7.4, here's how you can upgrade.
First, make sure homebrew's information is up-to-date
1brew update
1brew update
Next, tell homebrew to update PHP (this took a while to run)
1brew upgrade php
1brew upgrade php
Next we need to upgrade Laravel Valet and make sure it is using PHP 8.
Hopefully you can now run php -v
and get 8.x
as a result. If not, you may need to uninstall PHP and run brew install php
Update Valet and its dependencies with Composer:
1composer global update
1composer global update
Finally, we need to tell Valet to use our new PHP version. Run the following command:
1valet use php --force
1valet use php --force
This forces valet to unlink (and re-link) the PHP version.
I often use Redis for queues, so I chose to upgrade that too.
First use Homebrew to upgrade Redis
1brew upgrade redis
1brew upgrade redis
Last step is using PECL to install the Redis extension in PHP. Then restart Valet and you're all set!
1pecl install redis2valet restart
1pecl install redis2valet restart
You should now be running on PHP 8. Enjoy!