Open main menu

Coding Standards

Revision as of 03:19, 12 January 2016 by Freephile (talk | contribs) (Text replacement - "<abbr title="[^"]+">(.*)<\/abbr>" to "$1")

In the PHP community, as well as every other development community, there has been a long-standing tradition of establishing 'Coding Standards' that specify how developers should format their code. So, the PHP Framework Interop(ability) Group came up with PSR-1 and PSR-2 that deal with the issue specifically.

Tools

Fabien Potencier (Sensio Labs) has released the PHP Coding Standards Fixer tool which fixes most issues in your code. It helps you follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents.

Greg Sherwood (Squiz Labs) is the maintainer of PHP CodeSniffer, which was originally a PEAR project. PHP_CodeSniffer is a PHP5 script that tokenises and "sniffs" PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.