Created
March 30, 2017 09:13
-
-
Save timneutkens/5eea42a7ef3f9d24a6f96a9859c838db to your computer and use it in GitHub Desktop.
Valet PHP switcher
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
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Please provide a version. For example: php56, php70 or php71" | |
echo "Valet only supports PHP 5.6+" | |
exit | |
fi | |
if ! brew ls --versions $1 > /dev/null; then | |
echo "Installing $1" | |
brew install $1 | |
fi | |
valet stop | |
brew unlink php56 &> /dev/null | |
brew unlink php70 &> /dev/null | |
brew unlink php71 &> /dev/null | |
brew services stop php56 &> /dev/null | |
brew services stop php70 &> /dev/null | |
brew services stop php71 &> /dev/null | |
brew link $1 &> /dev/null | |
brew services start $1 &> /dev/null | |
valet install &> /dev/null | |
valet start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment