Add the following to the top of .bash_profile
:
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -2 | head -1`
alias composer='php /Applications/MAMP/bin/php/${PHP_VERSION}/bin/composer.phar'
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
```
## Using PHP7
If you _are_ using MAMP, then this will allow you to use the latest version installed with PHP.
```
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
```
## Example of Adding PHPUnit For Composer
```json
{
"require-dev": {
"phpunit/phpunit": "5.0.*"
}
}
```
## MySQL as Executable Functions
If you're interested in tweaking what version of MySQL is used and _how_ it's used, then take a look at the code below.This will makes it usable from within shell scripts (unlike an alias) and will also avoid conflicting with other tools on the system.
```
mysql() {
/Applications/MAMP/Library/bin/mysql "$@"
}
mysqladmin() {
/Applications/MAMP/Library/bin/mysqladmin "$@"
}
export -f mysql
export -f mysqladmin
```
It's outside the scope of the general purposes of this document, but worth noting should this come up.