PHP_CompatInfo

PHP_CompatInfo makes it extremely easy to learn and maintain your components compatibilities for reuse in your PHP applications.

Table of Contents

What Is PHP_CompatInfo

images/checkmark.png When developers are ready to package their distributions, how to avoid to forget some dependencies.

Introduction

PHP_CompatInfo (alias PHPCI) 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.

Code Stability

PHPCI is here to improve your code stability for distribution, and learn some statistics (namespaces, traits, interfaces, classes, functions, constants, extensions) about existing code.

How To Install

images/gophp5_logo.png PHPCI takes advantage of new features in PHP 5.2 or greater.

Minimal Requirements

Before you install PHP_CompatInfo, you will need an operating system with PHP 5.3.0 or later installed.

What You Need To Install First

Minimum Requirement Description
PEAR Installer 1.9.0 Used to install other PEAR packages
PEAR_Console_CommandLine 1.2.0 Command-line base engine of PHPCI tool
Bartlett PHP_Reflect 1.9.0 PHP parser used by PHPCI to detect elements such as namespaces, traits, interfaces, classes, constants
dom extension Used by the PHPCI CLI tool to read XML configuration
libxml extension Used by the PHPCI CLI tool to read XML configuration
pcre extension Used by the base class of PHPCI
SPL extension Used by the base class of PHPCI
Reflection extension Used by the base class of PHPCI

Installing via PEAR

Once all of the dependencies have been installed, you can then install PHPCI using the standard PEAR installer. Run the following commands as root (on Linux, OSX, and other UNIX-like operating systems) or as a user with administrator privileges on Windows.

$ pear channel-discover bartlett.laurent-laville.org
$ pear install -o php_compatinfo

Installing with Composer

Put a file named composer.json at the root of your project, with the content below:

{
    "require": {
        "pear-bartlett/PHP_CompatInfo": "2.26.*"
    },
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net"
        },
        {
            "type": "pear",
            "url": "http://bartlett.laurent-laville.org"
        }
    ]
}

And install with the following command:

$ php composer.phar install

Using PHP Archive (phar)

wget http://bartlett.laurent-laville.org/get/phpcompatinfo.phar
chmod +x phpcompatinfo.phar

Installing on Linux distributions

PHP_CompatInfo could be installed as RPM, using the package installer.

In Fedora, from official repository.

In Enterprise Linux (RHEL, CentOS, Scientific Linux, Oracle Linux, …), from the EPEL repository.

# yum install php-bartlett-PHP-CompatInfo

Create Your Own References

images/magic_wand.png PHPCI 2.0 basically handle more than 60 references. Each new major version may included some new references.

Creates a new Reference via CLI

If extensions, you want to be supported is not yet included in base code, you can add it yourself.

With your extension loaded, pick up the script genext.php in source code repository, and follow these instructions.

Documentation

images/books.png All documentation are available online and for download in several formats.

Online Documentation

Head to the PHP_CompatInfo User Guide for information or examples to get started.

Offline Documentation

The PHP_CompatInfo book is available in a selection of formats. You can download the documentation for offline reading.

Single HTML file Many HTML files HTML Help file PDF A4 file PDF US file EPUB file
phpci-book.html.zip phpci-book.chunked.zip phpci-book.chm.zip phpci-book-a4.pdf phpci-book-us.pdf phpci-book.epub.zip

License

images/shield.png PHPCI is open-source software, licensed under the BSD license.

BSD License

The full legal text of the BSD 3-clause license is given below.

 Copyright (c) 2010-2013, Laurent Laville <pear@laurent-laville.org>

 Credits to :

    * Davey Shafik
      Original author, he introduced his proposal in 2004,
      that gave birth of a PEAR package named PHP_CompatInfo.
    * Remi Collet
      Contributor on many extensions and unit tests since version 2.0.0RC2


 All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
     * Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
     * Neither the name of the authors nor the names of its contributors
       may be used to endorse or promote products derived from this software
       without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.