PHPackages                             phpcompatibility/phpcompatibility-symfony - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpcompatibility/phpcompatibility-symfony

ActivePhpcodesniffer-standard[Utility &amp; Helpers](/categories/utility)

phpcompatibility/phpcompatibility-symfony
=========================================

A set of rulesets for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Symfony polyfill libraries.

1.2.3(7mo ago)8964.8k↓22.7%4[1 issues](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/issues)2LGPL-3.0-or-laterPHPCI passing

Since Oct 7Pushed 1mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (13)Versions (14)Used By (2)

PHPCompatibilitySymfony
=======================

[](#phpcompatibilitysymfony)

[![Latest Stable Version](https://camo.githubusercontent.com/585eaffd13017abecea2409d0ddf986e94f200038448605776ba4e9155524c6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870636f6d7061746962696c6974792f706870636f6d7061746962696c6974792d73796d666f6e793f6c6162656c3d737461626c65)](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)[![Latest Unstable Version](https://camo.githubusercontent.com/d171b24fb543578707bbd6ac903b1b1e22806b266f271b6f538b6cf0471837d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870636f6d7061746962696c6974792f706870636f6d7061746962696c6974792d73796d666f6e793f696e636c7564655f70726572656c6561736573266c6162656c3d7072652d72656c65617365)](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)[![License](https://camo.githubusercontent.com/acfe9788dffee43569c44e4744f514968427d4003db87061208fc72833eace53/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f504850436f6d7061746962696c6974792f504850436f6d7061746962696c69747953796d666f6e793f636f6c6f723d303061376137)](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/blob/master/LICENSE)[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/actions/workflows/ci.yml)

Using PHPCompatibilitySymfony, you can analyse the codebase of a project using any of the [Symfony polyfill libraries](https://github.com/symfony?utf8=?&q=polyfill), for PHP cross-version compatibility.

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

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

A set of rulesets for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Symfony polyfill libraries.

These rulesets prevent false positives from the [PHPCompatibility standard](https://github.com/PHPCompatibility/PHPCompatibility) by excluding back-fills and polyfills which are provided by those libraries.

Symfony Polyfill LibraryCorresponding PHPCompatibility RulesetIncludes[`polyfill-php54`](https://github.com/symfony/polyfill-php54)`PHPCompatibilitySymfonyPolyfillPHP54`[`polyfill-php55`](https://github.com/symfony/polyfill-php55)`PHPCompatibilitySymfonyPolyfillPHP55`[`PHPCompatibilityPasswordCompat`](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat)[`polyfill-php56`](https://github.com/symfony/polyfill-php56)`PHPCompatibilitySymfonyPolyfillPHP56`[`polyfill-php70`](https://github.com/symfony/polyfill-php70)`PHPCompatibilitySymfonyPolyfillPHP70`[`PHPCompatibilityParagonieRandomCompat`](https://github.com/PHPCompatibility/PHPCompatibilityParagonie)[`polyfill-php71`](https://github.com/symfony/polyfill-php71)`PHPCompatibilitySymfonyPolyfillPHP71`[`polyfill-php72`](https://github.com/symfony/polyfill-php72)`PHPCompatibilitySymfonyPolyfillPHP72`[`polyfill-php73`](https://github.com/symfony/polyfill-php73)`PHPCompatibilitySymfonyPolyfillPHP73`[`polyfill-php74`](https://github.com/symfony/polyfill-php74)`PHPCompatibilitySymfonyPolyfillPHP74`[`polyfill-php80`](https://github.com/symfony/polyfill-php80)`PHPCompatibilitySymfonyPolyfillPHP80`[`polyfill-php81`](https://github.com/symfony/polyfill-php81)`PHPCompatibilitySymfonyPolyfillPHP81`[`polyfill-php82`](https://github.com/symfony/polyfill-php82)`PHPCompatibilitySymfonyPolyfillPHP82`[`polyfill-php83`](https://github.com/symfony/polyfill-php83)`PHPCompatibilitySymfonyPolyfillPHP83`[`polyfill-php84`](https://github.com/symfony/polyfill-php84)`PHPCompatibilitySymfonyPolyfillPHP84`[`polyfill-php85`](https://github.com/symfony/polyfill-php85)`PHPCompatibilitySymfonyPolyfillPHP85`Note

About "Includes":
Some polyfills have other polyfills as dependencies. If the PHPCompatibility project offers a dedicated ruleset for the polyfill dependency, that ruleset will be included in the ruleset for the higher level polyfill.

For example:
As the `polyfill-php70` library declares `random_compat` [as a dependency](https://github.com/symfony/polyfill-php70/blob/v1.19.0/composer.json), the `PHPCompatibilitySymfonyPolyfillPHP70` ruleset includes the `PHPCompatibilityParagonieRandomCompat` ruleset.

In practice, this means that if your project uses several polyfills, you can use the information in "Includes" to help you decide which rulesets to use.

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+.
- [PHPCompatibilityPasswordCompat](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat) 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-symfony:"^2.0@dev"
```

Next, run:

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

If all went well, you will now see that the PHPCompatibility and a range of PHPCompatibilitySymfony and other PHPCompatibility standards are installed for PHP\_CodeSniffer.

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

[](#upgrade-instructions)

To upgrade this package, run the following command:

```
composer update --dev phpcompatibility/phpcompatibility-symfony --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 commands to inspect the code in your project for PHP cross-version compatibility:

```
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP54
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP55
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP56
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP70
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP71
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP72
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP73
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP74
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP80
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP81
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP82
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP83
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP84
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP85

# You can also combine the standards if your project uses several:
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP55,PHPCompatibilitySymfonyPolyfillPHP70,PHPCompatibilitySymfonyPolyfillPHP73
```

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

To get the most out of the PHPCompatibilitySymfony rulesets, 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.

For example:

```
# For a project which should be compatible with PHP 5.3 up to and including PHP 7.0:
vendor/bin/phpcs -p . --standard=PHPCompatibilitySymfonyPolyfillPHP56 --runtime-set testVersion 5.3-7.0

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

For more detailed information about setting the `testVersion`, see the README of the generic [PHPCompatibility](https://github.com/PHPCompatibility/PHPCompatibility)([PHPCompatibility-testVersion](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=PHPCompatibilitySymfonyPolyfillPHP71 --extensions=php --runtime-set testVersion 5.3-
```

License
-------

[](#license)

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

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance75

Regular maintenance activity

Popularity46

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 81% 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 ~257 days

Recently: every ~427 days

Total

11

Last Release

208d ago

Major Versions

1.2.3 → 2.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 (141 commits)")[![wimg](https://avatars.githubusercontent.com/u/313511?v=4)](https://github.com/wimg "wimg (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![fredden](https://avatars.githubusercontent.com/u/334786?v=4)](https://github.com/fredden "fredden (1 commits)")[![GaryJones](https://avatars.githubusercontent.com/u/88371?v=4)](https://github.com/GaryJones "GaryJones (1 commits)")

---

Tags

phpphp-codesnifferphpcompatibilityphpcs-standardsymfony-polyfill-librariescompatibilitypolyfillstandardsphpcssymfonystatic analysis

### Embed Badge

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

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

###  Alternatives

[symfony/polyfill-ctype

Symfony polyfill for ctype functions

4.0k982.0M125](/packages/symfony-polyfill-ctype)[phpcompatibility/phpcompatibility-paragonie

A set of rulesets for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.

1031.3M10](/packages/phpcompatibility-phpcompatibility-paragonie)[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.

22130.6M587](/packages/phpcompatibility-phpcompatibility-wp)[symfony/polyfill-php56

Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions

1.6k204.0M28](/packages/symfony-polyfill-php56)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6333.4M58](/packages/phpcsstandards-phpcsutils)[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)

PHPackages © 2026

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