Introduction
PHP_CompatInfo is a PHP library that parse any data source (file, directory) to find out the minimum version and extensions required for it to run. A CLI tool is available, giving results without to write a line of code.
The major version 2 is a full rewrites to PHP5, that used exceptions to raise errors, and an autoloader to dynamically load required classes.
Since version 2.0.0RC3 the PHP parser engine used is PHP_Reflect. It’s an improved version from basic concept of PHP_TokenStream.
If you want a PHP4 version compatible, you should consider to have a look on the branch 1.x solution hosted on PEAR repository : PEAR::PHP_CompatInfo 1.9.0
![]() |
Its recommanded to migrate to PHP5, because PHP4 version is not maintained anymore. |
Features
-
Parse a single file
-
Parse a directory recursively or not
-
Parse a list of files and/or directories
-
Ability to give a list of extensions to ignore when calculating the version needed
-
Ability to give a list of interfaces to ignore when calculating the version needed
-
Ability to give a list of traits to ignore when calculating the version needed
-
Ability to give a list of classes to ignore when calculating the version needed
-
Ability to give a list of functions to ignore when calculating the version needed
-
Ability to give a list of constants to ignore when calculating the version needed.
-
Ability to give a list of files to ignore when calculating the version needed
-
Ability to give a list of directories to ignore when calculating the version needed
-
Ability to use a custom extensions list or by default only extensions loaded, to parse PHP code
-
Event driven and listeners system to audit parsing process
Requirements
-
PHP 5.2.1 or newer
-
Console_CommandLine 1.2.0 or newer from default PEAR channel
-
PHP_Reflect 1.5.0 or newer from Bartlett PEAR channel
-
tokenizer extension
-
pcre extension
-
SPL extension
-
DOM extension
-
libxml extension
-
Reflection extension
-
(optional) PEAR 1.9.0 or newer from default PEAR channel
-
(optional) Net_Growl 2.6.0 or newer from default PEAR channel
-
(optional) PHPUnit 3.6.0 or newer from PHPUnit PEAR channel
-
(optional) PHP_Timer 1.0.0 or newer from PHPUnit PEAR channel
-
(optional) an XSLT processor if you want to produce an xHTML report from a phpci xml report
Extensions supported
Version | Count | New extensions since previous version |
---|---|---|
2.0.0 | 61 | |
2.1.0 | 63 | memcache, memcached |
2.2.0 | 65 | ldap, oauth |
2.3.0 | 67 | Reflection, Zip |
2.4.0 | 67 | |
2.5.0 | 75 | exif, lzf, mailparse, mssql, solr, sphinx, xhprof, Yaml |
2.6.0 | 75 | |
2.7.0 | 75 | |
2.8.0 | 80 | amqp, geoip, inclued, mongo, XCache |
2.9.0 | 80 | |
2.10.0 | 83 | igbinary, imagick, odbc |
2.11.0 | 83 | |
2.12.0 | 83 |
The phpci tool may inform you on what of those extensions are or not loaded on your system.
Run command
$ phpci list-references
Will output results as follow. May differ depending of your extensions loaded.
------------------------------------------------------------------------------- PHP COMPAT INFO DATABASE REFERENCE ------------------------------------------------------------------------------- EXTENSION VERSION PHP min/Max ------------------------------------------------------------------------------- amqp 1.0.9 5.2.0 apc 3.1.14 4.3.0 L bcmath 4.0.0 L bz2 4.0.4 L calendar 4.0.0 Core 5.4.11 4.0.0 L ctype 4.0.4 L curl 4.0.2 L date 4.0.0 L dom 20031129 5.0.0 enchant 1.1.0 5.0.0 ereg 4.0.0/5.3.0 L exif 4.0.1 fileinfo 1.0.5 4.0.0 L filter 0.11.0 4.0.0 L ftp 4.0.0 L gd 4.0.0 geoip 1.0.8 4.3.0 L gettext 4.0.0 gmp 5.1.0 L hash 1.0 4.0.0 L iconv 4.0.5 igbinary 1.1.1 5.2.0 imagick 3.1.0RC2 5.1.3 L imap 4.0.0 inclued 0.1.3 5.1.0 intl 2.0.1 5.2.0 L json 1.2.1 5.2.0 L ldap 4.0.0 L libxml 5.0.0 lzf 1.6.2 4.0.0 mailparse 2.1.6 4.3.0 L mbstring 4.0.6 L mcrypt 4.0.0 memcache 3.0.7 4.3.3 memcached 2.1.0 5.2.0 L mhash 4.0.0/5.2.17 mongo 1.3.3 5.0.0 mssql 4.0.0 L mysql 1.0 4.0.0 L mysqli 0.1 5.0.0 OAuth 1.2.2 5.1.0 L odbc 4.0.0 L openssl 4.0.4 pcntl 4.1.0 L pcre 4.0.0 L PDO 1.0.4dev 5.1.0 pgsql 4.0.0 Phar 2.0.1 5.2.0 posix 306939 4.0.0 readline 2.0.1 4.0.0 recode 2.0.1 4.0.0 L Reflection 5.0.0 L session 4.0.0 L shmop 4.0.0 L SimpleXML 0.1 5.0.0 snmp 4.0.0 L soap 5.0.0 L sockets 4.1.0 solr 1.0.2 5.2.3 sphinx 1.2.0 5.1.3 L SPL 0.2 5.0.0 L SQLite 2.0-dev 5.0.0 sqlite3 0.7 5.3.0 ssh2 0.12 4.0.0 L standard 5.4.11 4.0.0 sysvmsg 306939 4.3.0 sysvsem 4.0.0 sysvshm 4.0.0 L tidy 2.0 4.3.0 L tokenizer 0.1 4.2.0 L wddx 4.0.0 XCache 3.0.1 4.3.0 L xdebug 2.2.1 4.3.0 xhprof 0.9.2 5.2.0 L xml 4.0.0 L xmlreader 0.1 5.0.0 L xmlrpc 0.51 4.1.0 L xmlwriter 0.1 5.1.2 L xsl 0.1 5.0.0 yaml 1.1.0 5.2.0 L zip 1.11.0 4.3.0 L zlib 2.0 4.3.0 ------------------------------------------------------------------------------- A TOTAL OF 83 EXTENSIONS WERE FOUND AND 47 LOADED ------------------------------------------------------------------------------- Time: 1 second, Memory: 5.25Mb -------------------------------------------------------------------------------
-
The
L
flag tells us what extensions are loaded -
The
VERSION
column specify the version of extension that was documented -
The
PHP min/Max
column specify which are the php versions (minimum and maximum) supported by the extension
Documentation
Head to the PHP_CompatInfo User Guide available online for information or examples to get started.
The PHP_CompatInfo book is available in a selection of formats. You can download the documentation for offline reading.
Language | Single HTML file | Many HTML files | HTML Help file | PDF A4 file | PDF US file | EPUB file |
---|---|---|---|---|---|---|
English | phpci-book.html.zip 606Kb | phpci-book.chunked.zip 534Kb | phpci-book.chm.zip 545Kb | phpci-book-a4.pdf 655Kb | phpci-book-us.pdf 655Kb | phpci-book.epub.zip 526Kb |
Appendixes
Changelog
You want to learn more about previous versions. Read the full changelog.
License
You are free to do whatever you want, even in a commercial environment. You are also encouraged to contribute. Read the full license.
Credits
I would like to thanks here specially a guy without who this PHP QA tool won’t be born.
Original author, he introduced his proposal in 2004, that gave birth of a PEAR package named PHP_CompatInfo.
http://daveyshafik.com/ Davey Shafik
I would also like to thanks a guy who help me to enhance support of more than 50 extensions.
Contributor of many extensions reference and unit tests. He has joined the team on version 2.0.0RC2
http://blog.famillecollet.com/ Remi Collet
Links
All pages of this site, and user guide were generated with AsciiDoc 8.6.8, assisted by FOP 1.0 (for PDFs). Automated build process uses Phing 2.4.14
Convert the HTML Help source (.hhp and .html) files to HTML Help (.chm) files using the Microsoft HTML Help Compiler.