Posts Learn Components Snippets Categories Tags Tools About

Laravel Valet Change PHP Version on MacOS

Learn how to change PHP versions using the Laravel Valet command line to maintain separate versions of PHP in your local machine

Created on Nov 09, 2021


In this short snippet, you will learn how to make use of the Laravel Valet command.


Install Homebrew package manager.
/bin/bash -c "$(curl -fsSL"

Step 1: Install Laravel Valet

Install Laravel Valet command line globally using the composer command line.
composer global require laravel/valet
Complete the valet installation with the "valet install".
valet install

Step 2: Install Multiple PHP Versions

By default, you might only have 1 PHP version and you can install the other PHP versions with Homebrew. First, search the available PHP versions.
brew search php
Next, install the other PHP versions using the brew command below.
brew install php

brew install [email protected]

brew install [email protected]

Step 3: Switch PHP Version

Now that you have all the other PHP versions you can easily switch PHP versions. If you want to switch to PHP version 7.3 you can use the command below.
valet use [email protected]
Then to change back to the latest version you can use the command below.
valet use php

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for Laravel Valet Change PHP Version on MacOS


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours