1.安裝sublime並安裝好package control
2.安裝phpcs
3.打開command並利用composer安裝
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
[PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
[PHPMD](https://github.com/phpmd/phpmd)
```bash
composer global require squizlabs/php_codesniffer fabpot/php-cs-fixer phpmd/phpmd
```
4.將PHP Code Sniffer => Settings - Default的內容複製到 PHP Code Sniffer => Settings - User
5.修改Settings - User
```json
{
"phpcs_executable_path": "phpcs.bat",
"php_cs_fixer_on_save": true,
"php_cs_fixer_executable_path": "php-cs-fixer.bat",
"phpcbf_on_save": true,
"phpcbf_executable_path": "phpcbf.bat",
"phpmd_run": true,
"phpmd_executable_path": "phpmd.bat"
}
```
如果進行存檔時還是會提示錯誤訊息修改下列參數即可
```json
{
"phpcs_php_prefix_path": "php路徑\\php.exe"
}
```
參考
[wamp安裝](http://phpwrite.blogspot.tw/2015/04/uniform.html)
[composer安裝](http://phpwrite.blogspot.tw/2015/04/windowscomposer.html)
沒有留言:
張貼留言