Created
August 19, 2022 13:41
-
-
Save paperscissors/48505df0248695a4faaa0055cc8caa02 to your computer and use it in GitHub Desktop.
Bash command to switch between multiple versions of PHP on MacOs, Homebrew, and Valet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switchphp () { | |
phpversion="$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d".")" | |
brew unlink php@$phpversion && brew link php@$1 && valet use php@$1 --force | |
} | |
# then switchphp 8.1, switchphp 7.4, whatever versions installed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment