This gist assumes that you've followed these instructions to set up your AMP on OS X, and that you're using php-version to change PHP versions as needed.
Note that I have selected the wrong tool for the job with php-version. However once I got this working I wanted to document it in case I want to replicate the config without selecting a more appropriate tool. If you stumble upon this gist and decide to find a better tool for the job I'd appreciate a comment directing myself and others to something better.
Now if you're sure you want to drive a square peg into a round hole, continue reading...
First, modify php-version to run a post version change script when php versions are changed.
$ vi $(brew --prefix php-version)/php-version.sh