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

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

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.

2.1.8(7mo ago)22130.6M—9.5%14[1 issues](https://github.com/PHPCompatibility/PHPCompatibilityWP/issues)20LGPL-3.0-or-laterPHPCI passing

Since Jul 16Pushed 1mo ago7 watchersCompare

[ Source](https://github.com/PHPCompatibility/PHPCompatibilityWP)[ Packagist](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)[ Docs](http://phpcompatibility.com/)[ GitHub Sponsors](https://github.com/PHPCompatibility)[ GitHub Sponsors](https://github.com/jrfnl)[ RSS](/packages/phpcompatibility-phpcompatibility-wp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (16)Used By (20)

PHPCompatibilityWP
==================

[](#phpcompatibilitywp)

[![Latest Stable Version](https://camo.githubusercontent.com/843e052105e66ce96aa822440c13ceb2833ca7e242677af52c4b91badb7e6c36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870636f6d7061746962696c6974792f706870636f6d7061746962696c6974792d77703f6c6162656c3d737461626c65)](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)[![Latest Unstable Version](https://camo.githubusercontent.com/7f9c5ca66996a3b7b3a0dc7e2b44b169b6ad1dd05e17af184b06f95b25798afb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870636f6d7061746962696c6974792f706870636f6d7061746962696c6974792d77703f696e636c7564655f70726572656c6561736573266c6162656c3d7072652d72656c65617365)](https://packagist.org/packages/phpcompatibility/phpcompatibility-wp)[![License](https://camo.githubusercontent.com/c3489d59f21001419fcacf0a80c25e385d8747024b1f4ec9a753ce00c223b8b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f504850436f6d7061746962696c6974792f504850436f6d7061746962696c69747957503f636f6c6f723d303061376137)](https://github.com/PHPCompatibility/PHPCompatibilityWP/blob/master/LICENSE)[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityWP/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityWP/actions/workflows/ci.yml)

Using PHPCompatibilityWP, you can analyse the codebase of a WordPress-based project for PHP cross-version compatibility.

What's in this repo ?
---------------------

[](#whats-in-this-repo-)

A ruleset for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects based on the WordPress CMS.

This WordPress specific ruleset prevents false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and poly-fills which are provided by WordPress.

Funding
-------

[](#funding)

**This project needs funding.**

The project team has spend thousands of hours creating and maintaining the PHPCompatibility packages. This is unsustainable without funding.

If you use PHPCompatibility, please fund this work by setting up a monthly contribution to the [PHP\_CodeSniffer Open Collective](https://opencollective.com/php_codesniffer).

Requirements
------------

[](#requirements)

- PHP &gt; 5.4
- [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) &gt;= 3.13.3. Use the latest stable release of PHP\_CodeSniffer for the best results.
- [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility) 10.0.0+.
- [PHPCompatibilityParagonie](https://github.com/PHPCompatibility/PHPCompatibilityParagonie) 2.0.0+.

Installation instructions
-------------------------

[](#installation-instructions)

The only supported installation method is via [Composer](https://getcomposer.org/).

[Composer](https://getcomposer.org/) will automatically install the project dependencies and register the external rulesets with PHP\_CodeSniffer using the [Composer PHPCS plugin](https://github.com/PHPCSStandards/composer-installer/).

Run the following from the root of your project:

```
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev phpcompatibility/phpcompatibility-wp:"^3.0@dev"
```

Next, run:

```
vendor/bin/phpcs -i
```

If all went well, you will now see that the `PHPCompatibility`, `PHPCompatibilityWP` and some more PHPCompatibility standards are installed for PHP\_CodeSniffer.

Upgrade instructions
--------------------

[](#upgrade-instructions)

To upgrade this package, run the following command:

```
composer update --dev phpcompatibility/phpcompatibility-wp --with-dependencies
```

Tip

If you have a *root* requirement in your project for one of the packages used by this project, you may need to update with `--with-all-dependencies` instead.

How to use
----------

[](#how-to-use)

You can now use the following command to inspect your code:

```
vendor/bin/phpcs -p . --standard=PHPCompatibilityWP
```

By default, you will only receive notifications about deprecated and/or removed PHP features.

To get the most out of the PHPCompatibilityWP standard, you should specify a `testVersion` to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features.

The WordPress minimum PHP requirement was 5.2.4 up to WP 5.1.

- As of WP 5.2, the new minimum PHP requirement is PHP 5.6.20.
- As of WP 6.3, the new minimum PHP requirement is PHP 7.0.0.
- As of WP 6.6, the new minimum PHP requirement is PHP 7.2.24.

To enforce for PHPCompatibility to run against the PHP version you want to support, add `--runtime-set testVersion 7.2-` to your command-line command or add `` to your [custom ruleset](https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset), replacing `7.2-` with a `testVersion` of your choice.

For example:

```
# For a project which should be compatible with PHP 5.6 and higher:
vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --runtime-set testVersion 5.6-
```

For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions) standard.

### Testing PHP files only

[](#testing-php-files-only)

By default PHP\_CodeSniffer &lt; 4.0 will analyse PHP, JavaScript and CSS files. As the PHPCompatibility sniffs only target PHP code, you can make the run slightly faster by telling PHP\_CodeSniffer to only check PHP files, like so:

```
vendor/bin/phpcs -p . --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6-
```

License
-------

[](#license)

All code within the PHPCompatibility organisation is released under the GNU Lesser General Public License (LGPL). For more information, visit .

###  Health Score

67

—

FairBetter than 100% of packages

Maintenance78

Regular maintenance activity

Popularity66

Solid adoption and visibility

Community46

Growing community involvement

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 76.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 ~225 days

Recently: every ~83 days

Total

13

Last Release

153d ago

Major Versions

1.0.0 → 2.0.02018-10-07

2.1.8 → 3.0.0-alpha12025-10-22

### Community

Maintainers

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

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

---

Top Contributors

[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (123 commits)")[![wimg](https://avatars.githubusercontent.com/u/313511?v=4)](https://github.com/wimg "wimg (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![GaryJones](https://avatars.githubusercontent.com/u/88371?v=4)](https://github.com/GaryJones "GaryJones (7 commits)")[![johnbillion](https://avatars.githubusercontent.com/u/208434?v=4)](https://github.com/johnbillion "johnbillion (3 commits)")[![rodrigoprimo](https://avatars.githubusercontent.com/u/77215?v=4)](https://github.com/rodrigoprimo "rodrigoprimo (2 commits)")[![afragen](https://avatars.githubusercontent.com/u/1296790?v=4)](https://github.com/afragen "afragen (1 commits)")[![fredden](https://avatars.githubusercontent.com/u/334786?v=4)](https://github.com/fredden "fredden (1 commits)")[![swissspidy](https://avatars.githubusercontent.com/u/841956?v=4)](https://github.com/swissspidy "swissspidy (1 commits)")[![dingo-d](https://avatars.githubusercontent.com/u/8638515?v=4)](https://github.com/dingo-d "dingo-d (1 commits)")

---

Tags

phpphp-codesnifferphpcompatibilityphpcs-standardwordpresscompatibilitystandardsphpcswordpressstatic analysis

### Embed Badge

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

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

###  Alternatives

[wp-coding-standards/wpcs

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

2.8k42.5M1.6k](/packages/wp-coding-standards-wpcs)[phpcsstandards/phpcsextra

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

10324.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)[phpcompatibility/phpcompatibility-all

A set of rulesets for PHP\_CodeSniffer to check for PHP cross-version compatibility issues and opportunities to modernize code in PHP projects.

1361.7k](/packages/phpcompatibility-phpcompatibility-all)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)

PHPackages © 2026

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