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 or equal than 7.2 for parsing source code in a format PHP 5.2 to PHP 8.0
- PHP 7.2 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 ^5.5
The database connection information is stored as an environment variable called DATABASE_URL
.
# to use mysql:
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
# to use mariadb:
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=mariadb-10.5.8"
# to use sqlite:
DATABASE_URL="sqlite:///${HOME}/.cache/bartlett/compatinfo-db.sqlite"
# to use postgresql:
DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
If you change database connection, you have to run following commands:
vendor/bin/doctrine orm:schema-tool:create
vendor/bartlett/php-compatinfo-db/bin/compatinfo-db db:init
At dependencies installation, Composer use the sqlite back-end. You need to set up in your environment the DATABASE_URL
variable.
If you use sqlite default back-end, you MUST run composer run post-install-cmd
command.
Uses the BOX to compile your phar version of application.
Configuration file (box.json.dist
) is provided with each release of phpCompatInfo.
Full documentation is written in MarkDown format, and HTML export is possible with Daux.io.
See output results at https://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 8.0
- 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
- PHP-Parser Node Visitors
- Profiler
- Collection of Sniffs
-
Configurations
- Use of PSR11 containers to configure application services.
- Laurent Laville (Lead Dev)
- Thanks to Nikita Popov who wrote a marvellous PHP Parser.
- Thanks also to Remi Collet, a contributor of first hours.
- Credits to Davey Shafik. He introduced his proposal in 2004, that gave birth of a PEAR package named PHP_CompatInfo.