Add the function to your bash profile Ensure brew is installed Run it!
Example:
brewphus install 8.0brewphus use 8.0
# or
brewphus switch 8.0| function brewphus() { | |
| ACTION=$1 | |
| VERSION=$2 | |
| VERSION_STRING="shivammathur/php/php@${VERSION}" | |
| case $ACTION in | |
| install) | |
| brew update | |
| brew tap shivammathur/php | |
| brew install $VERSION_STRING | |
| ;; | |
| switch | use) | |
| OUTPUT="brew link --overwrite --force $VERSION_STRING" | |
| if ( ${OUTPUT} | grep 'Warning: Already linked' ); then | |
| brew unlink php | |
| $(OUTPUT) | |
| fi | |
| ;; | |
| *) | |
| echo 'You did not define an action. brewphus {upgrade|update} {version}' | |
| ;; | |
| esac | |
| } |