# PHPCompatibility

> PHP_CodeSniffer sniffs that check PHP code for cross-version compatibility

Source: https://talira.ai/catalog/phpcompatibility-ptwv532y
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Plugin
- Categories: [developer tools / linting](https://talira.ai/categories/developer-tools/linting), [languages / php](https://talira.ai/categories/languages/php)
- Licence: LGPL-3.0-or-later[^2][^3]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [PHPCompatibility](https://talira.ai/orgs/phpcompatibility.md)

PHPCompatibility is a set of sniffs for [PHP_CodeSniffer](https://talira.ai/catalog/php-codesniffer-zrnhrrbz.md) that checks PHP code for compatibility with higher and lower versions of PHP. Set a testVersion (a single version or a range) on the command line or in a ruleset, and it reports features that don't exist or behave differently in those versions. It aims to cover every compatibility change since PHP 5.0 up to the latest release, and framework, CMS and polyfill rulesets build on it.

## Links

- GitHub: https://github.com/PHPCompatibility/PHPCompatibility

## Problems it solves

- check whether my PHP code will run on a newer PHP version before upgrading
- find PHP features in my code that an older PHP version doesn't support
- lint a PHP codebase for version compatibility in CI

## Features

- sniffs that flag PHP features unavailable or changed in a chosen PHP version or range
- testVersion set per run or in a custom ruleset
- consistent results whichever PHP version runs PHP_CodeSniffer
- framework, CMS and polyfill specific rulesets that extend it

## Limitations

- Coverage of PHP compatibility changes isn't complete, and changes before PHP 5.1 are only patchily covered.[^1]
- Needs PHP 7.2+, PHP_CodeSniffer 4.0.2+ and PHPCSUtils 1.1.2+.[^1]

## Trust

Overall: 0.64 out of 1.
Signals: maintenance 1.00, adoption 0.67, momentum 0.35, community 0.72, backing 0.30, extensibility 0.00.

- last commit 9 days ago
- 88 commits in the last 90 days
- latest release 9.3.5 6.9 years ago
- 2.3k GitHub stars
- 61 contributors
- accepts sponsorship (Github, Github, Open Collective)
- has a company behind it

## Related

- Works with [PHP_CodeSniffer](https://talira.ai/catalog/php-codesniffer-zrnhrrbz.md)

## Alternatives

- [PHP Parallel Lint](https://talira.ai/catalog/php-parallel-lint-s12275mm.md): Checks the syntax of PHP files in parallel
- [PHPMD](https://talira.ai/catalog/phpmd-5bvh074k.md): PHP Mess Detector: finds bugs and code smells in PHP
- [WordPress Coding Standards for PHP_CodeSniffer](https://talira.ai/catalog/wordpress-coding-standards-for-php-codesniffer-598761fd.md): PHP_CodeSniffer rules that enforce WordPress coding conventions
- [ESLint](https://talira.ai/catalog/eslint-0nyjt04g.md): Find and fix problems in your JavaScript code.
- [PHP_CodeSniffer](https://talira.ai/catalog/php-codesniffer-zrnhrrbz.md): Detect and fix coding standard violations in PHP
- [PHPCompatibilityWP](https://talira.ai/catalog/phpcompatibilitywp-12sqwxa2.md): PHPCompatibility ruleset for WordPress projects that skips WordPress's own polyfills

## Sources

[^1]: https://github.com/PHPCompatibility/PHPCompatibility/blob/develop/README.md (checked 28 Nov 2026)
[^2]: https://github.com/PHPCompatibility/PHPCompatibility/blob/develop/composer.json (checked 28 Nov 2026)
[^3]: https://github.com/PHPCompatibility/PHPCompatibility/blob/develop/PHPCompatibility/Sniff.php (checked 28 Nov 2026)
