phpCompatInfo version 3.2.0 build ...
Download
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 :
Other alternative installations are possible. Please refer to the documentation for details on how to do this.
Configuration
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.
Structure
- source-providers
-
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 .
- plugins
-
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:runandanalyser:listcommands wouldn’t be available. - analysers
-
this entry list all analysers that may be used with the
analyser:runcommand.Don’t miss it, else you could not run theanalyser:runcommand.
Execution
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 Summary Extensions 10 Namespaces 8 Interfaces 4 Traits 0 Classes 132 Methods 732 Functions 3 Constants 11 Internal Functions 43 Versions PHP min 5.3.7 PHP max
Summary
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.
Next
Choose your way depending of your skill level.