Logan Bailey

Adventures In Web Development

Blog, About, GitHub, and LinkedIn

My day job requires that I work on a variety of projects. A few of the older projects have yet to be migrated to php 7 while newer projects are written on 7.1. Do to system constraints on composer, I have both php 5.6 as well as 7.1 installed on my machine. However when I run composer ..., it uses my default php is 7.1. To get composer working, I'd have to look up where the 5.6 binary was and run /path/to/5.6/binary composer. The other day, I finally had enough of this an added these aliases to my .bash_rc:

alias php56="`(brew --prefix homebrew/php/php56)`/bin/php"
alias composer56="php56 `which composer`"

The first alias, php56, is an alias to the php 5.6 binary. The second alias, composer56 prefixes the php 5.6 binary path to the composer executable.

Posted In: