

You should then see WordPress-Core et al listed when you run phpcs -i. wpcsĪnd then add the ~/projects/phpcs/bin directory to your PATH environment variable via your.

Install PHP_CodeSniffer by following its installation instructions (via Composer, Phar file, PEAR, or Git checkout).ĭo ensure that PHP_CodeSniffer's version matches our requirements, if, for example, you're using VVV.Ĭlone the WordPress standards repository: It is strongly suggested to require one of these plugins in your project to handle the registration of external standards with PHPCS for you. phpcodesniffer-composer-installer:"^0.6".composer-phpcodesniffer-standards-plugin.There are two actively maintained Composer plugins which can handle the registration of standards with PHP_CodeSniffer for you: When installing the WordPress Coding Standards as a dependency in a larger project, the above mentioned step 3 will not be executed automatically. Make phpcs command available from wpcs/vendor/bin.įor the convenience of using phpcs as a global command, you may want to add the path to the wpcs/vendor/bin directory to a PATH environment variable for your operating system.Register WordPress standards in PHP_CodeSniffer configuration.Install WordPress standards into wpcs directory.Standards can be installed with the Composer dependency manager:Ĭomposer create-project wp-coding-standards/wpcs -no-dev The WordPress Coding Standards require PHP 5.4 or higher and PHP_CodeSniffer version 3.7.2 or higher. In July 2018, version 1.0.0 of the project was released.In 2016, Juliette Reinders Folmer began contributing heavily, adding more commits in a year than anyone else in the five years since the project was added to GitHub.Grimes began significant contributions, along with maintenance from Gary Jones. In May 2015, an initial documentation ruleset was added as WordPress-Docs.

In April 2012 XWP started to dedicate resources to develop and lead the creation of the sniffs and rulesets for WordPress-Core, WordPress-VIP ( VIP), and WordPress-Extra.In May 2011 the project was forked and added to GitHub by Chris Adams.On 22nd April 2009, the original project from Urban Giraffe was packaged and published.It ensures code quality and adherence to coding conventions, especially the official WordPress Coding Standards. This project is a collection of PHP_CodeSniffer rules (sniffs) to validate code developed for WordPress. Running your code through WPCS automatically using CI tools.Using PHPCS and WPCS from within your IDE.WordPress Coding Standards for PHP_CodeSniffer
