We distribute a PHP Archive (PHAR) that contains all required dependencies of PHP CompatInfo bundled in a single file.

Make it executable, and put it into your $PATH.

$ chmod +x phpcompatinfo.phar
$ mv phpcompatinfo.phar /usr/local/bin/phpcompatinfo

$ phpcompatinfo --version

You can also immediately use the PHAR after you have downloaded it.

$ wget http://bartlett.laurent-laville.org/get/phpcompatinfo.phar
$ php phpcompatinfo.phar --version

With both methods then you have this output :

phpCompatInfo version 3.2.0 build ...
represents the Git commit hash of this version

Other alternative installations are possible. Please refer to the documentation for details on how to do this.

With the minimalist JSON file phpcompatinfo.json
    "source-providers": [
            "in": ". as current",
            "name": "/\\.(php|inc|phtml)$/"
    "plugins": [
            "name": "Analyser",
            "class": "Bartlett\\Reflect\\Plugin\\Analyser\\AnalyserPlugin"
    "analysers" : [
            "name": "Namespace",
            "class": "Bartlett\\CompatInfo\\Analyser\\NamespaceAnalyser"
            "name": "Extension",
            "class": "Bartlett\\CompatInfo\\Analyser\\ExtensionAnalyser"
            "name": "Interface",
            "class": "Bartlett\\CompatInfo\\Analyser\\InterfaceAnalyser"
            "name": "Trait",
            "class": "Bartlett\\CompatInfo\\Analyser\\TraitAnalyser"
            "name": "Class",
            "class": "Bartlett\\CompatInfo\\Analyser\\ClassAnalyser"
            "name": "Function",
            "class": "Bartlett\\CompatInfo\\Analyser\\FunctionAnalyser"
            "name": "Constant",
            "class": "Bartlett\\CompatInfo\\Analyser\\ConstantAnalyser"

Put it in your project’s folder. Alternative locations are possible. Please refer to the documentation for details on how to do this.

this entry provide list of your data sources to parse.

Like CompatInfo always needs a JSON file to run, Remi Collet shared a workaround solution exposed here that allows to run :

$ phpcompatinfo analyser:run .
this entry list all plugins added to the core base code of PHP Reflect.
Don’t forget to add at least this default content, else the analyser:run and analyser:list commands wouldn’t be available.
this entry list all analysers that may be used with the analyser:run command.
Don’t miss it, else you could not run the analyser:run command.

With a default phpcompatinfo.json as detailed above, put in the src/ folder of the CompatInfo source code, and invoke the following command :

$ phpcompatinfo analyser:run .

and you should obtain something like this :

Data Source Analysed

Directories                                          8
Files                                              123

Summary Analysis

  Extensions                                        10
  Namespaces                                         8
  Interfaces                                         4
  Traits                                             0
  Classes                                          132
  Methods                                          732
  Functions                                          3
  Constants                                         11
  Internal Functions                                43

  PHP min                                        5.3.7
  PHP max

Let’s review what we’ve done :

  • downloaded the latest stable PHAR version.

  • prepared your JSON configuration file that is required to run CompatInfo commands.

  • executed your first parse on the CompatInfo data source.

Choose your way depending of your skill level.

Read more
  • Want to learn more about the command line interpreter (CLI) version, interface that do CompatInfo an easy tool without to write a line of PHP code, have a look on user’s guide

  • Want to learn more about CompatInfo architecture and /or you want to extends it to match your needs, have a look on developer’s guide

  • You are a user of previous version 2.26 that is really different, and want to upgrade to the new major version 3, and keep your old environment still running, have a look on migration’s guide