As you code longer and longer on the same project and don’t run PHP Code Standards tests, you will encounter messy code sooner or later.
Well, FriendsOfPhp come to the rescue here! I’m totally in love with this project;
To get it working, install it on your system, execute and voila, here you are. I will show you some install tricks, but for all the documentation you should just checkout the Github of this project. And when you are there, leave them some love!
Install on MacOsx (Homebrew)
$ brew install homebrew/php/php-cs-fixer
Install on Linux
wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer sudo chmod a+x php-cs-fixer sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
Usage on both
php-cs-fixer fix /path/to/project --level=psr2 --verbose
I do it without the verbose, your console will run crazy ;-)