PHPackages                             axepress/wp-graphql-cs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. axepress/wp-graphql-cs

ActivePhpcodesniffer-standard[Testing &amp; Quality](/categories/testing)

axepress/wp-graphql-cs
======================

PHP\_CodeSniffer rules (sniffs) for the WPGraphQL ecosystem.

2.1.0(4mo ago)1060.9k↑694.4%2[2 issues](https://github.com/AxeWP/WPGraphQL-Coding-Standards/issues)7MITPHP &gt;=7.4CI passing

Since Jun 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/AxeWP/WPGraphQL-Coding-Standards)[ Packagist](https://packagist.org/packages/axepress/wp-graphql-cs)[ RSS](/packages/axepress-wp-graphql-cs/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (13)Used By (7)

WPGraphQL Coding Standards for PHP\_CodeSniffer
===============================================

[](#wpgraphql-coding-standards-for-php_codesniffer)

[![Packagist License](https://camo.githubusercontent.com/49264d49050852fb4f2ea44fea8a989441a0a666817b3124c959e504989585e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61786570726573732f77702d6772617068716c2d63733f636f6c6f723d677265656e)](https://camo.githubusercontent.com/49264d49050852fb4f2ea44fea8a989441a0a666817b3124c959e504989585e8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61786570726573732f77702d6772617068716c2d63733f636f6c6f723d677265656e) [![Packagist Downloads](https://camo.githubusercontent.com/23d13672d42e58130c5b15b0a820292b8aa503a473a9d530659bbc3f3831cba0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61786570726573732f77702d6772617068716c2d6373)](https://camo.githubusercontent.com/23d13672d42e58130c5b15b0a820292b8aa503a473a9d530659bbc3f3831cba0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61786570726573732f77702d6772617068716c2d6373) [![Packagist Version](https://camo.githubusercontent.com/b8a049b379ce171d10c008fe665eab1632d678e258b71311d9e24f709766dcef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61786570726573732f77702d6772617068716c2d63733f6c6162656c3d737461626c65)](https://camo.githubusercontent.com/b8a049b379ce171d10c008fe665eab1632d678e258b71311d9e24f709766dcef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61786570726573732f77702d6772617068716c2d63733f6c6162656c3d737461626c65) [![GitHub commits since latest release (by SemVer)](https://camo.githubusercontent.com/e738e9d3e0b8c43cfd0cabf4faa332fd1bd40a1a521de69546a4e1ad77edd38e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f41786557502f57504772617068514c2d436f64696e672d5374616e64617264732f322e312e30)](https://camo.githubusercontent.com/e738e9d3e0b8c43cfd0cabf4faa332fd1bd40a1a521de69546a4e1ad77edd38e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f41786557502f57504772617068514c2d436f64696e672d5374616e64617264732f322e312e30) [![GitHub Repo stars](https://camo.githubusercontent.com/c4c2b7aafc00b0ec4997e815eb870f4aa59c87f155ced6fadb80b77d10e11e29/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f41786557502f57504772617068514c2d436f64696e672d5374616e64617264733f7374796c653d736f6369616c)](https://camo.githubusercontent.com/c4c2b7aafc00b0ec4997e815eb870f4aa59c87f155ced6fadb80b77d10e11e29/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f41786557502f57504772617068514c2d436f64696e672d5374616e64617264733f7374796c653d736f6369616c) [![Tests](https://camo.githubusercontent.com/81dbe0890db5be602ac9cad3aa734f65b2d86899c31e1dee228949c2e90cbe2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61786577702f57504772617068514c2d436f64696e672d5374616e64617264732f746573742e796d6c3f6272616e63683d646576656c6f70266c6162656c3d4349)](https://camo.githubusercontent.com/81dbe0890db5be602ac9cad3aa734f65b2d86899c31e1dee228949c2e90cbe2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f61786577702f57504772617068514c2d436f64696e672d5374616e64617264732f746573742e796d6c3f6272616e63683d646576656c6f70266c6162656c3d4349)

---

This project is a collection of rules and sniffs for [PHPCS](https://github.com/PHPCSStandards/PHP_CodeSniffer) to validate code developed for the [WPGraphQL](https://github.com/wp-graphql/wp-graphql) ecosystem. It uses rules from:

- [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards)
- [Automattic VIP Coding Standards](https://github.com/Automattic/VIP-Coding-Standards)
- [Slevomat Coding Standard](https://https://github.com/slevomat/coding-standard)
- [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) &amp; [PHPCompatibilityWP](https://github.com/PHPCompatibility/PHPCompatibilityWP)

Why use these standards?
------------------------

[](#why-use-these-standards)

Shared coding standards are a great way to ensure consistency in your codebase. They also help to avoid common pitfalls and mistakes, which in turn helps to reduce bugs and technical debt.

These sorts of issues are particularly relevant in the WPGraphQL ecosystem, where we must create robust, performant and type-safe code that often relies on legacy PHP and WordPress code.

Additionally, by ensuring all developers are following the same guidelines and best practices, we can make it easier to collaborate on projects and ensure they stay up-to-date and compatible with WPGraphQL core and other ecosystem plugins.

While currently this ruleset only contains a collection of sniffs from other projects, we hope to add more custom sniffs in the future to help with common issues in the WPGraphQL ecosystem (e.g. ensuring properly named GraphQL types, description formatting, lazy-loaded fields, etc).

Rulesets
--------

[](#rulesets)

The project provides a superset of sniffs that the WPGraphQL community may need. If you use the `WPGraphQL` standard you will get all the checks.

You can use the following standard names when invoking `phpcs` to select the sniffs you want to use.

- [`WPGraphQL`](./WPGraphQL/ruleset.xml) - complete set with all of the sniffs in the project.
    - [`WPGraphQL-Minimum`](./WPGraphQL-Minimum/ruleset.xml): basic ruleset for WPGraphQL projects.
    - [`WPGraphQL-Strict`](./WPGraphQL-Strict/ruleset.xml): includes all the sniffs in the `WPGraphQL-Minimum` ruleset, plus additional functional sniffs to help you produce enterprise-ready code.
    - [`WPGraphQL-Extra`](./WPGraphQL-Extra/ruleset.xml): includes all the sniffs in the `WPGraphQL-Strict` ruleset, plus additional sniffs to keep your code consistent across your project.
    - [`WPGraphQL-Docs`](./WPGraphQL-Docs/ruleset.xml): includes sniffs for doc-blocks and inline comments.
- [`WPGraphQL-Core`](./WPGraphQL-Core/ruleset.xml): includes all the sniffs currently used by the [WPGraphQL core project](https://github.com/wp-graphql/wp-graphql/blob/develop/phpcs.xml.dist). This includes the `WPGraphQL-Strict` and `WPGraphQL-Docs` ruleset, with a few sniffs disabled.

Installation
------------

[](#installation)

The recommended way to install this project is with [Composer](https://getcomposer.org/). Run the following command to install it into your project:

```
composer require --dev axepress/wp-graphql-cs
```

This will install the latest compatible versions of PHPCS and *all the external sniffs and rulesets*, so there is no need to include them in your dependencies list.

We recommend the [PHP\_CodeSniffer Standards Composer Installer Plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer), which handles the registration of all of the installed standards, so there is no need to set the `installed_paths` config value manually, for single or multiple standards.

For more information about installation and usage, see the [WPCS readme](https://github.com/WordPress/WordPress-Coding-Standards#Installation).

Configuring your custom ruleset.
--------------------------------

[](#configuring-your-custom-ruleset)

> To quick-start your project, you can copy the [example config file](./phpcs.xml.dist.example) to your project root and rename it to `.phpcs.xml.dist`, then update the individual values as explained below.

The best way to use these sniffs in your project is to create a [local configuration file](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Advanced-Usage#using-a-default-configuration-file) that extends the rulesets provided by this project. When you name this file either `.phpcs.xml`, `phpcs.xml`, `.phpcs.xml.dist` or `phpcs.xml.dist`, PHP\_CodeSniffer will automatically locate it as long as it is placed in the directory from which you run the CodeSniffer or in a directory above it.

In this file, you will want to configure the following:

- [`testVersion`](./phpcs.xml.dist.example#L33) - The minimum PHP version you want to test against. This should be the *lowest version of PHP that you want to support*. While WPGraphQL officially supports PHP 7.1+, we recommend testing against PHP 7.3 (the current lowest version actively [tested against](https://github.com/wp-graphql/wp-graphql/blob/develop/.github/workflows/testing-integration.yml)) or higher.
- [`minimum_wp_version`](./phpcs.xml.dist.example#L43) - The minimum WordPress version you want to test against. This should be the lowest version of WordPress that you want to support. While WPGraphQL officially supports WordPress 5.0+, we recommend testing against WordPress 5.6 (the current lowest version actively [tested against](https://github.com/wp-graphql/wp-graphql/blob/develop/.github/workflows/testing-integration.yml)) or higher.
- [`WordPress.WP.I18n.text_domain`](./phpcs.xml.dist.example#L63) - The text domain used in your project. This is used by the `WordPress.WP.I18n` sniff to check that all translatable strings are assigned to a text domain. We recommend using the format `wp-graphql-`.
- [`WordPress.NamingConventions.PrefixAllGlobals`](./phpcs.xml.dist.example#L57) - The list of prefixes used in your project. This is used by the `WordPress.NamingConventions.PrefixAllGlobals` sniff to check that all global functions, classes, constants, and variables are prefixed.

Development and Support
-----------------------

[](#development-and-support)

The project is actively maintained by [AxePress Development](https://axepress.dev). Community contributions are *welcome* and **encouraged**.

Basic support is provided for free, both in [this repo](https://github.com/AxeWP/WPGraphQL-Coding-Standards/issues) and in [WPGraphQL's official Discord](https://discord.gg/55h7WmYZff).

Priority support and custom development are available to [our Sponsors](https://github.com/sponsors/AxeWP).

[![](https://camo.githubusercontent.com/0f9e1b45a01d19d25b515dce9b59bb9faa9a4cccc5333c7166b8ba36c1059065/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d53706f6e736f7225323055732532302534302532304178655750266d6573736167653d254532253944254134266c6f676f3d47697448756226636f6c6f723d253233666538653836267374796c653d666f722d7468652d6261646765)](https://github.com/sponsors/AxeWP)

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance80

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~120 days

Recently: every ~201 days

Total

9

Last Release

120d ago

Major Versions

1.0.0-beta.3 → 2.0.0-beta.12023-09-17

PHP version history (2 changes)1.0.0-beta.1PHP &gt;=7.2

2.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/33212bff2915bd72792772a2d3203abe0402352b6be6ba65081036f10560c6e6?d=identicon)[justlevine](/maintainers/justlevine)

---

Top Contributors

[![justlevine](https://avatars.githubusercontent.com/u/29322304?v=4)](https://github.com/justlevine "justlevine (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

---

Tags

coding-conventionshacktoberfesthacktoberfest2023php-codesnifferphpcsrulesetwordpresswordpress-developmentwordpress-standardswp-graphqlwpgraphqlstandardsphpcswordpressstatic analysiswpgraphqlwpcs

### Embed Badge

![Health badge](/badges/axepress-wp-graphql-cs/health.svg)

```
[![Health](https://phpackages.com/badges/axepress-wp-graphql-cs/health.svg)](https://phpackages.com/packages/axepress-wp-graphql-cs)
```

###  Alternatives

[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.7k42.5M1.6k](/packages/wp-coding-standards-wpcs)[phpcompatibility/phpcompatibility-wp

A ruleset for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.

21830.6M587](/packages/phpcompatibility-phpcompatibility-wp)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)[phpcsstandards/phpcsextra

A collection of sniffs and standards for use with PHP\_CodeSniffer.

10224.3M44](/packages/phpcsstandards-phpcsextra)[automattic/vipwpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

25510.2M145](/packages/automattic-vipwpcs)[acquia/coding-standards

PHP\_CodeSniffer rules (sniffs) for Acquia coding standards

214.8M28](/packages/acquia-coding-standards)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
