一、安装
添加镜像,加速下载
./composer.phar config -g repo.packagist composer https://packagist.phpcomposer.com
CodeSniffer
composer.phar global require "squizlabs/php_codesniffer=*"
Mess Detector
composer.phar global require "phpmd/phpmd=*"
二、PhpStorm配置phpcs, phpmd位置
File -> Default Setting -> Language & Frameworks -> Code Sniffer -> Config[Local] 点击 ... 按钮 -> path: C:Users{username}AppDataRoamingComposervendorinphpcs.bat
File -> Default Setting -> Language & Frameworks -> Mess Detector -> Config[Local] 点击 ... 按钮 -> path: C:Users{username}AppDataRoamingComposervendorinphpmd.bat
三、PhpStorm启用phpcs, phpmd
File -> Default Setting -> Editor -> Inspections -> PHP -> PHP Code Sniffer validation (打上勾)-> Coding standard -> PSR2 -> Apply
File -> Default Setting -> Editor -> Inspections -> PHP -> PHP Mess Detector validation (打上勾)-> Options(选择相应规则) -> Apply