How to fix PHP CS Fixer errors in Atom code editor on Ubuntu

Atom beautify is a free package for Atom text editor to beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more codes on your Atom text editor. PHP CS Fixer or PHP Coding Standards Fixer is a tool to fix PHP coding standards as defined in the PSR-1 and PSR-2 in your code. Sometimes beautification of PHP code in Atom text editor shows PHP CS Fixer related errors. To stop these errors you need to install and configure PHP CS Fixer on Atom code editor.

Install and configure PHP CS Fixer on Atom text editor:

Open the terminal app in ubuntu and run (Type and enter) the below code in terminal. this will download PHP CS Fixer on ubuntu.

wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer

then type and enter the below code.

sudo chmod a+x php-cs-fixer

Type your ubuntu password. And then run the below command.

sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer

To run the PHP CS Fixer type and enter the below command.

php-cs-fixer

Then open the Atom text editor, in the editor click the Edit menu and select Preferences option.

Suggested Read:  How to install Museeks music player on ubuntu

Then click the Packages menu option.

In the packages search option type atom-beautify and hit the enter key. Atom beautify package will come under community packages category. Click the setting button under atom beautify.

Under settings click the Executables option. Under Executables click the PHP-CS-Fixer and enter the php-cs-fixer absolute path.

To find the php-cs-fixer path run the below command in terminal

which php-cs-fixer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

*