Jul 20, 2018
✍️ Automate PHP-CS-Fixer on PhpStorm
Some times ago, @curtchan asked me if there is any articles about how to automate php-cs-fixer with PhpStorm.
Here we go !
Actually it’s really easy, you have to:
- Have the
php-cs-fixerphar installed inside/usr/local/bin/directory - Have a
.php_csfile on root directory of the project you wanna have this automation
If you have both, just download: this watcher
And to install it on your project, go to: Preferences > Tools > File Watchers
On this page you’ll find a “Import” button (green arrow going inside a square). Click it and use the downloaded watcher.
That watcher will run php-cs-fixer every time you goes through a file from PhpStorm.
Simply ! :-)