Find out the minimum version and the extensions required for a piece of code to run

5.3.0 2020-07-08 07:11 UTC


Stable Upcoming
Latest Stable Version Unstable Version
Minimum PHP Version) Minimum PHP Version)

PHP CompatInfo is a library that can find the minimum version and the extensions required for a piece of code to run.

Running on PHP greater than 7.1 for parsing source code in a format PHP 5.2 to PHP 7.4


  • PHP 7.1.3 or greater
  • PHPUnit 7 or greater (if you want to run unit tests)


The recommended way to install this library is through composer. If you don't know yet what is composer, have a look on introduction.

composer require bartlett/php-compatinfo

Build PHAR distribution

To build PHAR distribution, you'll need to get a copy of this project

WARNING: Don't forget to run following command (before compiling archive), if you want to have a PHAR manifest up-to-date !

php phar-manifest.php > manifest.txt

Run following command

box.phar compile

You should get output that look like

Box version 3.8.4@120b0a3 2019-12-13 17:22:43 UTC

 // Loading the configuration file "/shared/backups/bartlett/php-compat-info/box.json.dist".

🔨  Building the PHAR "/shared/backups/bartlett/php-compat-info/bin/phpcompatinfo.phar"

? Removing the existing PHAR "/shared/backups/bartlett/php-compat-info/bin/phpcompatinfo.phar"
? No compactor to register
? Adding main file: /shared/backups/bartlett/php-compat-info/bin/phpcompatinfo
? Adding requirements checker
? Adding binary files
    > No file found
? Auto-discover files? No
? Exclude dev files? No
? Adding files
    > 1129 file(s)
? Using stub file: /shared/backups/bartlett/php-compat-info/phar-stub.php
? Skipping dumping the Composer autoloader
? Removing the Composer dump artefacts
? Compressing with the algorithm "GZ"
    > Warning: the extension "zlib" will now be required to execute the PHAR
? Setting file permissions to 0755
* Done.

No recommendation found.
No warning found.

 // PHAR: 1155 files (1.65MB)
 // You can inspect the generated PHAR with the "info" command.

 // Memory usage: 25.54MB (peak: 26.54MB), time: 1sec


The documentation for PHP CompatInfo 5.0 in English is available online or downloadable offline to read it later (multiple formats available).

AsciiDoc source code are available on docs folder of the repository.


  • Laurent Laville (Lead Dev)
  • Thanks to Nikita Popov who wrote a marvellous PHP Parser and simplify the job of PHP Reflect.
  • Thanks also to Remi Collet, a contributor of first hours.


This project is licensed under the BSD-3-Clause License - see the LICENSE file for details