Skip to content

Instantly share code, notes, and snippets.

@markbiek
Created June 4, 2021 15:34
Show Gist options
  • Select an option

  • Save markbiek/3cd3b9d36fe8f6a5d86378e1cf2e4583 to your computer and use it in GitHub Desktop.

Select an option

Save markbiek/3cd3b9d36fe8f6a5d86378e1cf2e4583 to your computer and use it in GitHub Desktop.
Very complete script for switching PHP versions when using Laravel Valet
# Written by https://github.com/nickstewart95
echo Stop Brew
sudo brew services stop php
sudo brew services stop [email protected]
sudo brew services stop [email protected]
sudo brew services stop [email protected]
sudo brew services stop [email protected]
sudo brew services stop [email protected]
echo Unlinking previous PHP packages
brew unlink [email protected]
brew unlink [email protected]
brew unlink [email protected]
brew unlink [email protected]
brew unlink [email protected]
echo Installing package PHP $1
brew install php@$1
echo Linking PHP $1
brew link php@$1 --overwrite --force
echo Restarting services
brew services start php@$1
brew services start php
echo Linking valet
valet link php@$1
valet use php@$1 --force
composer global update
valet restart
echo Running
php -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment