Valet switch PHP version with these commands
Install PHP 5.6 and switch Valet to PHP 5.6
valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt
brew link php56
valet start
Then to switch back to PHP 7.1 it is as simple as:
valet stop
brew unlink php56
brew link php71
valet start
Then to switch to PHP 5.6:
valet stop
brew unlink php71
brew link php56
valet start
In Homebrew ^1.5 a lot of PHP extensions were removed, causing
brew install php56-mcrypt
not to work anymore.See the official announcement.
Luckily,
mcrypt
seems included in the newer formula for php@5.6Other extensions can be installed with PECL. It looks like you need to do this every time you switch between versions though.