bartlett/php-compatinfo

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

5.4.1 2020-10-06 12:43 UTC

README

Stable Upcoming
Latest Stable Version Unstable Version
Minimum PHP Version) Minimum PHP Version)
Branch Master Branch 6.0

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

Requirements

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

Installation

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 https://github.com/humbug/box

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

Documentation

Full documentation is written in MarkDown format, and HTML export is possible with Daux.io. See output results at http://bartlett.laurent-laville.org/php-compatinfo/ or raw *.md files in docs folder.

Table of Contents

  • Features

    • Parse source code in format PHP 5.2 to PHP 7.4
    • Detect PHP features for each Major/minor versions
    • Detect versions of all directives, constants, functions, classes, interfaces of 100 extensions and more
    • Display/Inspect list of extensions, and their versions supported
  • Components

  • Configurations

    • Use of PSR11 containers to configure application services.

Contributors

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

License

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