1. 安裝 PHP
brew install php71 --with-imap --with-homebrew-curl --with-homebrew-libressl
hombrew-curl 和 hombrew-libressl 選項(xiàng)是一個(gè)不錯的選擇纸镊。 我遇到一些卷曲請求與SSL崩潰沒有這些選項(xiàng)
對于完整的選項(xiàng)列表運(yùn)行brew options php71
2. 安裝 Xdebug
brew install php71-xdebug --build-from-source
- 添加 --build-from-source 選項(xiàng)是必要的,否則它會引發(fā)啟動時(shí)出現(xiàn)以下錯誤,Xdebug使用不同的引擎構(gòu)建:
Cannot load Xdebug - it was built with configuration API320160303,NTS, whereas running engine is API320160303,NTS,debug
3. 配置 Xdebug
更新 /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini 文件
以執(zhí)行以下操作:
[xdebug]
zend_extension="/usr/local/opt/php71-xdebug/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp"
xdebug.idekey=PHPSTORM
了解Xdebug文檔 尸折,了解每個(gè)選項(xiàng)有哪些好處。
4. PHPStorm 配置
9000端口在我的情況下被其他服務(wù)占用。 您可以將其更改為任何您想要的,只需確保IDE和Xdebug中的端口值匹配梁钾。
phpstorm-config.png
5. 安裝 Composer
5.1 使用 Packagist 鏡像
修改 composer 的全局配置文件
composer config -g repo.packagist composer https://packagist.phpcomposer.com
5.2 下載安裝 Composer
下載安裝腳本 - composer-setup.php - 到當(dāng)前目錄。
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
執(zhí)行安裝過程逊抡。
php composer-setup.php
刪除安裝腳本姆泻。
php -r "unlink('composer-setup.php');"
打開命令行窗口并執(zhí)行如下命令將前面下載的 composer.phar 文件移動到 /usr/local/bin/ 目錄下面:
sudo mv composer.phar /usr/local/bin/composer
5.3 基本操作
查看版本信息
composer --version
更新版本
composer selfupdate