Skip to content

Instantly share code, notes, and snippets.

@timneutkens
Created March 30, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timneutkens/5eea42a7ef3f9d24a6f96a9859c838db to your computer and use it in GitHub Desktop.
Save timneutkens/5eea42a7ef3f9d24a6f96a9859c838db to your computer and use it in GitHub Desktop.
Valet PHP switcher
#!/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