Download the PHP package phpcompatibility/php-compatibility without Composer

On this page you can find all versions of the php package phpcompatibility/php-compatibility. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-compatibility

PHP Compatibility Coding Standard for PHP_CodeSniffer

This is a set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility. It will allow you to analyse your code for compatibility with higher and lower versions of PHP.

PHP Version Support

The project aims to cover all PHP compatibility changes introduced since PHP 5.0 up to the latest PHP release. This is an ongoing process and coverage is not yet 100% (if, indeed, it ever could be). Progress is tracked on our GitHub issue tracker.

Pull requests that check for compatibility issues in PHP 4 code - in particular between PHP 4 and PHP 5.0 - are welcome as there are still situations where people need help upgrading legacy systems. However, coverage for changes introduced before PHP 5.1 will remain patchy as sniffs for this are not actively being developed at this time.

Funding

This project needs funding.

The project team has spend thousands of hours creating and maintaining this package. This is unsustainable without funding.

If you use PHPCompatibility, please fund this work by donating to the PHP_CodeSniffer Open Collective.

Requirements

The sniffs are designed to give the same results regardless of which PHP version you are using to run PHP_CodeSniffer. You should get consistent results independently of the PHP version used in your test environment, though for the best results it is recommended to run the sniffs on a recent PHP version in combination with a recent PHP_CodeSniffer version.

As of version 8.0.0, the PHPCompatibility standard can also be used with PHP_CodeSniffer 3.x.
As of version 9.0.0, support for PHP_CodeSniffer 1.5.x and low 2.x versions < 2.3.0 has been dropped.
As of version 10.0.0, support for PHP < 7.2 and PHP_CodeSniffer < 4.0.2 has been dropped (and support for PHP_CodeSniffer 4.x was added).

Installation

As of PHPCompatibility 10.0.0, installation via Composer using the below instructions is the only supported type of installation.

Composer will automatically install the project dependencies and register the PHPCompatibility ruleset with PHP_CodeSniffer using the Composer PHPCS plugin.

If you are upgrading from an older PHPCompatibility version to version 10.0.0, please read the Upgrade guide first!

Composer Project-based Installation

Run the following from the root of your project:

Composer Global Installation

Alternatively, you may want to install this standard globally:

Updating your PHPCompatibility install to a newer version

If you installed PHPCompatibility using either of the above commands, you can upgrade to a newer version as follows:

Using your PHPCompatibility install

You can verify that the PHPCompatibility standard is registered correctly by running vendor/bin/phpcs -i on the command line. PHPCompatibility and PHPCSUtils should both be listed as available standards.

Once you have installed PHPCompatibility using either of the above commands, use it as follows:

Pro-tip: For the convenience of using phpcs as a global command, use the Global install method and add the path to the %USER_DIRECTORY%/Composer/vendor/bin directory to the PATH environment variable for your operating system.

Sniffing your code for compatibility with specific PHP version(s)

Using a framework/CMS/polyfill specific ruleset

As of mid 2018, a limited set of framework/CMS specific rulesets is available. These rulesets are hosted in their own repositories.

Since the autumn of 2018, there are also a number of PHP polyfill specific rulesets available:

If you want to make sure you have all PHPCompatibility rulesets available at any time, you can use the PHPCompatibilityAll package GitHub | Packagist.

IMPORTANT: Framework/CMS/Polyfill specific rulesets do not set the minimum PHP version for your project, so you will still need to pass a testVersion to get the most accurate results.

Using a custom ruleset

Like with any PHP_CodeSniffer standard, you can add PHPCompatibility to a custom PHP_CodeSniffer ruleset.

You can also set the testVersion from within the ruleset:

Other advanced options, such as changing the message type or severity of select sniffs, as described in the PHPCS Annotated ruleset wiki page are, of course, also supported.

testVersion in the ruleset versus command-line

Starting with PHP_CodeSniffer 3.3.0, a testVersion set via the command-line will overrule the testVersion in the ruleset.

This allows for more flexibility when, for instance, your project needs to comply with PHP 5.5-, but you have a bootstrap file which needs to be compatible with PHP 5.2-.

Additionally, as of PHP_CodeSniffer 4.0.0, a testVersion set in an included ruleset can now be overruled from your project (root) ruleset.

PHPCompatibility specific options

At this moment, there are two sniffs which have a property which can be set via the ruleset. More custom properties may become available in the future.

The PHPCompatibility.Extensions.RemovedExtensions sniff checks for removed extensions based on the function prefix used for these extensions. This might clash with userland functions using the same function prefix.

To whitelist userland functions, you can pass a comma-delimited list of function names to the sniff.

The PHPCompatibility.Interfaces.RemovedSerializable sniff needs to know about all interfaces which extend the Serializable interface to provide the most reliable results. The sniff will warn when it encounters an interface extending the Serializable interface which is unknown to the sniff and recommend for the interface name to be added to the property.

To inform the sniff about additional interfaces providing the Serializable interface, add a snippet along the lines of the below to your custom ruleset:

Projects extending PHPCompatibility

There are hundreds of public projects using PHPCompatibility or extending on top of it. A short list of some that you might know or have a look at :

Contributing

Contributions are very welcome. Please read the CONTRIBUTING documentation to get started.

License

This code is released under the GNU Lesser General Public License (LGPL). For more information, visit https://www.gnu.org/licenses/lgpl-3.0.html


All versions of php-compatibility with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
squizlabs/php_codesniffer Version ^3.13.3 || ^4.0
phpcsstandards/phpcsutils Version ^1.1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpcompatibility/php-compatibility contains the following files

Loading the files please wait ...