下載php-cs-fixer
https://github.com/FriendsOfPHP/PHP-CS-Fixer您CLOUD9工作區:
$ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.0.0/php-cs-fixer.phar -O ~/php-cs-fixer
把它放在你~/bin
目錄:
$ mkdir ~/bin; mv ~/php-cs-fixer ~/bin
使文件可執行:
$ chmod a+x ~/bin/php-cs-fixer
配置IDE的自定義代碼格式化程序設置PHP使用所述格式化與whatever rules you want:
php-cs-fixer fix "$file" [email protected],@PSR2
這就是我的~/workspace/.c9/project.settings
文件的外觀:
...
"php": {
"@completion": true,
"@formatOnSave": true,
"@formatter": "php-cs-fixer fix \"$file\" [email protected],@PSR2",
"@path": ".:./vendor:/usr/local/bin"
},
...
真棒,此感謝! –
感謝其工作:) – user1510230