Sometimes it’s necessary/helpful to run MAMP’s version of PHP in the command line. A common issue I come across is systems that require the Mcrypt PHP extension (Yii2 and Laravel). It’s simple to setup a alias. Just copy and paste this code.
Note: Adjust your PHP version to match your desired version.
Then you can run PHP using phpmamp instead of php.