PHP Beautifier / Formatter for cloud9 IDE

In my Cloud09 IDE, I have enabled the "Custom Form Formatter" PHP setting

But saving the results in error: No code formatter set for php: please check your project settings there is no formatting predefined as with JS ( esformatter -i "$file" ), and google does not help either ...

enter image description here

How to use this option?

How to install PHP formatting on Cloud9?

My only search showed this Pear package , but it seems deprecated.

+5
source share
1 answer

Download php-cs-fixer https://github.com/FriendsOfPHP/PHP-CS-Fixer in the Cloud9 workspace:

 $ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.0.0/php-cs-fixer.phar -O ~/php-cs-fixer 

Put it in the ~/bin :

 $ mkdir ~/bin; mv ~/php-cs-fixer ~/bin 

Make an executable file:

 $ chmod a+x ~/bin/php-cs-fixer 

Configure your Formatter parameter for the IDE for PHP to use the formater with any rules you want :

 php-cs-fixer fix "$file" --rules=@Symfony ,@PSR2 

What my ~/workspace/.c9/project.settings file looks like:

 ... "php": { "@completion": true, "@formatOnSave": true, "@formatter": "php-cs-fixer fix \"$file\" --rules=@Symfony ,@PSR2", "@path": ".:./vendor:/usr/local/bin" }, ... 
+6
source

Source: https://habr.com/ru/post/1260814/


All Articles