= PHP_CompatInfo
:description: PHP_CompatInfo makes it extremely easy to learn and maintain your components compatibilities for reuse in your PHP applications.
include::revision.txt[]
include::attributes.txt[]

[role="features"]
== What Is PHP_CompatInfo

[role="features"]
.image:images/checkmark.png[] [clearfix]#When developers are ready to package their distributions, how to avoid to forget some dependencies.#
--
[medium]*Introduction*

PHP_CompatInfo (alias [label label-primary]#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.

[medium]*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.
--

[role="features"]
== How To Install

[role="features"]
.image:images/gophp5_logo.png[] [clearfix]#PHPCI takes advantage of new features in PHP 5.2 or greater.#
--
[medium]*Minimal Requirements*

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

[medium]*What You Need To Install First*

[options="header", cols="3,9", role="table table-bordered table-striped"]
|===========================
| Minimum Requirement | Description
| http://pear.php.net/package/PEAR/[PEAR Installer] 1.9.0
| Used to install other PEAR packages
| http://pear.php.net/package/Console_CommandLine[PEAR_Console_CommandLine] 1.2.0
| Command-line base engine of PHPCI tool
| Bartlett http://php5.laurent-laville.org/reflect[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
|===========================

[medium]*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
----

[medium]*Installing with Composer*

Put a file named [label label-default]#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
----

[medium]*Using PHP Archive (phar)*

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

[medium]*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 http://fedoraproject.org/wiki/EPEL[EPEL repository].
----
# yum install php-bartlett-PHP-CompatInfo
----
--

[role="features"]
== Create Your Own References

[role="features"]
.image:images/magic_wand.png[] [clearfix]#PHPCI 2.0 basically handle more than 60 references. Each new major version may included some new references.#
--
[medium]*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 [label label-default]#genext.php#
in https://github.com/llaville/php-compat-info/blob/master/contributions/genext.php[source code repository],
and follow these https://github.com/llaville/php-compat-info/blob/master/contributions/README.txt[instructions].
--

[role="features"]
== Documentation

[role="features"]
.image:images/books.png[] [clearfix]#All documentation are available online and for download in several formats.#
--
[medium]*Online Documentation*

Head to the PHP_CompatInfo link:manual/current/en/phpci-book.html[User Guide] for information or examples to get started.

[medium]*Offline Documentation*

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

[options="header", role="table table-bordered"]
|===========================
| Single HTML file | Many HTML files | HTML Help file | PDF A4 file | PDF US file | EPUB file
| link:{mandir}/en/phpci-book.html.zip[phpci-book.html.zip] | link:{mandir}/en/phpci-book.chunked.zip[phpci-book.chunked.zip] | link:{mandir}/en/phpci-book.chm.zip[phpci-book.chm.zip] | link:{mandir}/en/phpci-book-a4.pdf[phpci-book-a4.pdf] | link:{mandir}/en/phpci-book-us.pdf[phpci-book-us.pdf] | link:{mandir}/en/phpci-book.epub.zip[phpci-book.epub.zip]
|===========================
--

[role="features"]
== License

[role="features"]
.image:images/shield.png[] [clearfix]#PHPCI is open-source software, licensed under the BSD license.#
--
[medium]*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.
----
--
