PHP_CompatInfo User Guide

Overview of the project, its contents, and how to get started with your first parses

This guide documents the final stable version 2.12.1

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

Caution 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

Head to the Install Guide if it’s your first use with PHP_CompatInfo.

PHP_CompatInfo may be installed in several ways, choose your favorite.

See our tutorial to learn how to get started with your first parses.

  • use the default autoloader

  • use your own autoloader

  • run the CLI tool alternative

Configure the default options to match your need, and learn how to enlarge or limit parsing capabilities.

  • parse directories recursively

  • choose which file to scan

  • select pre-defined references or use your own data dictionaries

  • use the cache system

How to get informations without to write a line of code. Use the CLI tool.

  • list data dictionnaries contents

  • print multiple reports either on standard output (console) or to a file

Configure CLI options

Structure and contents of the XML configuration file that allow to configure the CLI tool.

Transform the XML report to HTML

Postprocessing the XML report file with XSLT to produces some nice HTML pages.

UML class diagrams

Architecture main components highlighted by the UML class diagrams.