-
Install PHP_CodeSniffer:
git clone git://github.com/squizlabs/PHP_CodeSniffer.git /path/to/phpcs sudo ln -s /path/to/phpcs/scripts/phpcs /usr/local/bin/phpcs
-
Install Symfony Coding Standard:
git clone git://github.com/argentumua/Symfony-coding-standard.git /path/to/Symfony ln -s /path/to/Symfony /path/to/phpcs/CodeSniffer/Standards
-
Set Symfony as coding standard by default:
phpcs --config-set default_standard Symfony
-
Checking a file (if Symfony is your standard by default)
phpcs path/to/file.php
-
Checking a file (if Symfony is NOT your standard by default)
phpcs --standard=Symfony /path/to/file.php
-
Checking a directory (if Symfony is your standard by default)
phpcs /path/to/directory
-
Checking a directory (if Symfony is NOT your standard by default)
phpcs --standard=Symfony /path/to/directory
-
NetBeans:
http://plugins.netbeans.org/plugin/40282/phpmd-php-codesniffer-plugin
-
PHPStorm
http://www.jetbrains.com/phpstorm/webhelp/using-php-code-sniffer-tool.html
-
Zend Studio
http://files.zend.com/help/Zend-Studio/content/working_with_php_codesniffer.htm
Use pre-commit hooks, which will make a code standard check for every commit.
-
For Git
http://git-scm.com/book/en/Customizing-Git-Git-Hooks
-
For SVN
http://pear.php.net/manual/ru/package.php.php-codesniffer.svn-pre-commit.php