Mac OS XでのPHP開発環境の構築

Composerのインストール

https://getcomposer.org/download/ を見てダウンロードおよび検証します。

$ php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
$ php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '41e71d86b40f28e771d4bb662b997f79625196afcca95a5abf44391188c695c6c1456e16154c75a211d238cc3bc5cb47') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"

インストールします。

$ chmod a+x composer.phar
$ mv composer.phar ~/bin/composer

関連ツールのインストール

$ composer global require hirak/prestissimo
$ composer global require bear/qatools

.bash_profileの設定

export PATH="./vendor/bin:$HOME/bin:$HOME/.composer/vendor/bin:/usr/local/php5/bin:$PATH"
alias phpx="php -dzend_extension=xdebug.so"
alias phpunitx="phpx $(which phpunit)"
alias phptest="phpmd src text ./phpmd.xml;phpcs;phpunit"

参考

Date: 2016/03/28

Tags: php, mac