Table of Contents

PHP CS Fixer

The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc., or other community driven ones like the Symfony one. You can also define your (team's) style through configuration.

https://github.com/FriendsOfPHP/PHP-CS-Fixer

Install (global):

wget https://cs.symfony.com/download/php-cs-fixer-v2.phar -O php-cs-fixer
sudo chmod a+x php-cs-fixer
sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer

update (global):

sudo php-cs-fixer self-update

Usage in dry run mode:

php-cs-fixer fix /path/to/code --dry-run

Sublime Text Plugin

Installing Package Control

Installing Packages

Plugin name: “PHP CS Fixer”

Config info:

https://github.com/adael/SublimePhpCsFixer

VSCode plugins

https://gruz.ml/en/tech-blog/joomla-tips-and-tricks/118-vs-code-joomla-coding-standards-php-linting-via-phpcs-and-php-cs-fixer.html