PHPackages                             lipemat/wp-phpcs - 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. lipemat/wp-phpcs

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

lipemat/wp-phpcs
================

PHP Codesniffer for a WordPress plugin

4.5.2(5mo ago)553.2k↓15.3%3MITPHPPHP &gt;=7.4.0CI passing

Since Dec 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/lipemat/wp-phpcs)[ Packagist](https://packagist.org/packages/lipemat/wp-phpcs)[ GitHub Sponsors](https://github.com/lipemat)[ RSS](/packages/lipemat-wp-phpcs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (52)Used By (0)

WP PHPCS
========

[](#wp-phpcs)

[![package version](https://camo.githubusercontent.com/e82edbe72cf0fdaa191cbb5e1de115a25653b8af13cd4619f2d5eb5218fb6915/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6970656d61742f77702d70687063732e7376673f6c6162656c3d76657273696f6e)](https://github.com/lipemat/wp-phpcs/releases) [![required WordPress version](https://camo.githubusercontent.com/b9e87a495812217da5213360a59a07c91c9120545bb718ab7f318e4b915eb673/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f776f726470726573732d3e3d342e382e302d677265656e2e737667)](https://camo.githubusercontent.com/b9e87a495812217da5213360a59a07c91c9120545bb718ab7f318e4b915eb673/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f776f726470726573732d3e3d342e382e302d677265656e2e737667) [![required PHP version](https://camo.githubusercontent.com/aa6f80a01a67d529358d1d6f3ac58287960123ecb6d28ea5e54ddc038e05ca43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6970656d61742f77702d70687063732e7376673f636f6c6f723d62726f776e)](https://camo.githubusercontent.com/aa6f80a01a67d529358d1d6f3ac58287960123ecb6d28ea5e54ddc038e05ca43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6970656d61742f77702d70687063732e7376673f636f6c6f723d62726f776e) [![Packagist version](https://camo.githubusercontent.com/626eda78c85106c429cbe5d1337a398d330e7e26d8e20e7d36055b6bf4388e89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6970656d61742f77702d70687063732e737667)](https://camo.githubusercontent.com/626eda78c85106c429cbe5d1337a398d330e7e26d8e20e7d36055b6bf4388e89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6970656d61742f77702d70687063732e737667)

PHP Codesniffer setup for a WordPress plugin.

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

[](#installation)

Use composer to install. Although this may be added directly to your plugins composer.json, it is recommended to install somewhere globally to reuse across projects.

If not using as a global library, your local `composer.json` will need to include the following config.

```
{
  "config": {
    "allow-plugins": {
      "dealerdirect/phpcodesniffer-composer-installer": true
    }
  }
}
```

Install via composer

```
composer require lipemat/wp-phpcs
```

Copy the `phpcs-sample.xml` file to the root of your plugin and rename to `phpcs.xml`. Adjust the configuration as desired.

Running
-------

[](#running)

The vendor/bin folder includes the scripts to run on either Windows or Unix. You may either add that directory to your PATH or call it verbosely like so:

```
{project dir}/vendor/bin/phpcs ./
```

OR

```
{project dir}/vendor/bin/phpcbf ./
```

You may also create your own script somewhere on your PATH. Here is an example phpcs.bat for Windows. This assumes you created a folder named wp-phpcs in your root and ran composer require there.

```
@echo off
C:\wp-phpcs\vendor\bin\phpcs %*

```

Automating
----------

[](#automating)

Once you have scripts added to your path for phpcs and phpcbf, you can use the included `git-hooks/pre-commit` to run PHP lint and PHPCS automatically before making any commit.

Copy the pre-commit file to your plugin's .git/hooks directory, and the rest is automatic.

Included Sniffs
---------------

[](#included-sniffs)

1. [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards#rulesets)
2. [WordPress VIP Coding Standards](https://github.com/Automattic/VIP-Coding-Standards)
3. [PHPCompatibilityWP](https://github.com/PHPCompatibility/PHPCompatibilityWP)
4. [PHPCSExtra](https://github.com/PHPCSStandards/PHPCSExtra#sniffs)

Lipe Sniffs
-----------

[](#lipe-sniffs)

This package ships with some *optional* `Lipe` namespaced sniffs.

1. `` for all our default configurations and sniffs.
    1. @note This configuration is opinionated, you probably just want to include desired sniff namespaces.
2. `` for detecting the deprecated uses of MySQL `SQL_CALC_FOUND_ROWS`.
3. `` for detecting using `??` in conditions.
4. `` for detecting using `??` in for loops.
5. `` for detecting slow meta queries.
    1. Like `WordPress.DB.SlowDBQuery.slow_db_query_meta_query` but supports using `EXISTS` and `NOT_EXISTS` meta queries.
6. `` for detecting slow `ORDER BY` clauses in WP\_Query.
7. `` for detecting uses of `post__not_in` clauses in WP\_Query.
8. `` for detecting missing uses of `suppress_filters` clauses in get\_posts.

LipePlugin Sniffs
-----------------

[](#lipeplugin-sniffs)

This package ships with some *optional* `LipePlugin` namespaced sniffs designed to be used with a distributed plugin or library.

1. `` for all the default configurations and sniffs.
    1. @note This configuration is opinionated, you probably just want to include desired sniff namespaces.
2. `` force using `static` instead of `self` to improve extensibility.
    1. 'ReturnType' - return type of methods.
    2. 'InstanceOf' - self instance for static calls.
    3. 'NewInstance' - Constructing via `new self()`.
    4. 'ScopeResolution' - Local constants via `self::`.
3. `` for distributed packages, which should not use `private` to improve extensibility.
4. `` for distributed packages, which should not use `strict_type` to improve compatibility.

Other Notes
-----------

[](#other-notes)

The `phpcs-sample.xml` has many things excluded. This is because some things don't really fit in with WordPress standards. You can remove any of `` items to make more strict. Remove them all if you really want to make your code strict.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance72

Regular maintenance activity

Popularity36

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 98.6% 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 ~59 days

Recently: every ~71 days

Total

50

Last Release

161d ago

Major Versions

1.4.0 → 2.0.02019-07-19

2.8.0 → 3.0.0-beta.12023-02-13

3.2.0 → 4.0.02023-10-12

PHP version history (5 changes)2.0.0PHP &gt;=5.4

v2.2.0PHP &gt;=5.6.20

3.0.0PHP &gt;=7.0.0

3.1.3PHP &gt;=7.2.0

4.3.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc40b48cf8242da779608fe27fa97a99eb1304bd8cb153e46950fe9f8ab46a18?d=identicon)[lipemat](/maintainers/lipemat)

---

Top Contributors

[![lipemat](https://avatars.githubusercontent.com/u/1688181?v=4)](https://github.com/lipemat "lipemat (276 commits)")[![migueliriano](https://avatars.githubusercontent.com/u/5392202?v=4)](https://github.com/migueliriano "migueliriano (4 commits)")

### Embed Badge

![Health badge](/badges/lipemat-wp-phpcs/health.svg)

```
[![Health](https://phpackages.com/badges/lipemat-wp-phpcs/health.svg)](https://phpackages.com/packages/lipemat-wp-phpcs)
```

###  Alternatives

[slevomat/coding-standard

Slevomat Coding Standard for PHP\_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.

1.5k123.5M1.8k](/packages/slevomat-coding-standard)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)[drupal/coder

Coder is a library to review Drupal code.

3043.6M461](/packages/drupal-coder)[wp-cli/wp-cli-tests

WP-CLI testing framework

422.7M87](/packages/wp-cli-wp-cli-tests)[moodlehq/moodle-cs

Moodle Coding Sniffer rules

242.8M5](/packages/moodlehq-moodle-cs)[youwe/testing-suite

Contains Youwe's default testing packages for php.

13176.9k8](/packages/youwe-testing-suite)

PHPackages © 2026

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