HydraWiki CodeSniffer Standards

v1.0.19 2020-01-29 17:19 UTC



This project implements a set of rules for use with [PHP CodeSniffer]0.

HydraWiki is based on MediaWiki's Coding Standards, it applies additional coding standards on top of the MediaWiki Standard.

See MediaWiki conventions from MediaWiki for a detailed description of the coding conventions that are validated by these rules. :-)

How to install

  1. Create a composer.json which adds this project as a dependency:

     	"require-dev": {
     		"hydrawiki/hydrawiki-codesniffer": "1.0.9"
     	"scripts": {
     		"test": [
     			"phpcs -p -s"
     		"fix": "phpcbf"
  2. Create a .phpcs.xml with our configuration:

     <?xml version="1.0"?>
     	<rule ref="./vendor/hydrawiki/hydrawiki-codesniffer/HydraWiki"/>
     	<arg name="extensions" value="php,php5,inc"/>
     	<arg name="encoding" value="UTF-8"/>
  3. Install: composer update
  4. Run: composer test
  5. Run: composer fix to auto-fix some of the errors, others might need manual intervention.
  6. Commit!

Note that for most MediaWiki projects, MediaWiki also recommend to add a PHP linter to your composer.json – see the full documentation for more details.


This extension is based off of the mediawiki-codesniffer extension created by MediaWiki and some parts of [PHP CodeSniffer]0.

Contributing and Licensing

This coding standard is used internally on HydraWiki projects in support of the Gamepedia Platform. This project is made public for ease of use by our team and it is not our intention to maintain it for public use as an alternative to the original project from which it was derived. However, if you do find it useful and want to contribute improvements to it, any merge request will be consider against our internal needs for this project before public considerations.

The project is available under MIT license unless otherwise noted in files that are used from other projects. These files retain the original license under which they were created.