stellarwp / nexcess-coding-standards
The Nexcess Coding Standard for PHP_CodeSniffer
Package info
github.com/stellarwp/nexcess-coding-standards
Type:phpcodesniffer-standard
pkg:composer/stellarwp/nexcess-coding-standards
Requires
- php: >=7.4
- automattic/vipwpcs: ^3.0
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpcompatibility/phpcompatibility-wp: ^2.1
- slevomat/coding-standard: ^8.0
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2026-06-18 17:38:38 UTC
README
The Nexcess Coding Standard is a set of PHP_CodeSniffer rules for Nexcess PHP and WordPress projects.
Requirements
- PHP 7.4+
Installation
This package should be installed as a development dependency for your project:
$ composer require --dev stellarwp/nexcess-coding-standards
After installation, the standard is available to PHPCS as Nexcess.
Project Ruleset
To use this ruleset, create a phpcs.xml.dist in the root of the project and add the following content:
<?xml version="1.0"?> <ruleset> <arg name="basepath" value="." /> <arg name="extensions" value="php" /> <arg name="severity" value="4" /> <arg name="tab-width" value="4" /> <arg name="parallel" value="80" /> <arg name="colors" /> <!-- Update to the PHP version your production/local docker container runs on. --> <config name="testVersion" value="8.0" /> <!-- php -r 'echo PHP_VERSION_ID;' --> <config name="php_version" value="80022" /> <!-- Fix WordPress typing breaking PHPCS. --> <config name="minimum_supported_wp_version" value="7.0" /> <!-- Ignore warnings, show progress of the run and show sniff names. --> <arg value="nps" /> <!-- Directories to be checked. --> <file>./wp-content/plugins/core</file> <file>./wp-content/themes/core</file> <file>./wp-content/mu-plugins</file> <!-- Exclude files. --> <exclude-pattern>*-config.php</exclude-pattern> <exclude-pattern>*vendor/</exclude-pattern> <exclude-pattern>*tests/*</exclude-pattern> <exclude-pattern>*.twig</exclude-pattern> <exclude-pattern>*webpack/</exclude-pattern> <!-- Include the Nexcess coding standard. --> <rule ref="Nexcess" /> </ruleset>
Add phpcs.xml to your .gitignore.
Manual Usage
PHPCS
$ ./vendor/bin/phpcs --standard=Nexcess /path/to/files/**.php
PHPCBF
$ ./vendor/bin/phpcbf --standard=Nexcess /path/to/files/**.php
License
This library is licensed under the terms of the MIT license.