![]() PHP_CompatInfo : The Definitive Guide |
Rewrites of core API following the MVC pattern came from a user request that wanted to customized its CLI output. Even if output-level switch already exists, there is no easy way with no process-logic dependency.
A word about the new
architecture: Parser logic may be found in class
PHP_CompatInfo_Parser
, while
PHP_CompatInfo
class is still the main
controller, but just a wrapper to parser methods. Each output format
(csv, xml, text, html, array, null) is produced by an independant
renderer ( PHP_CompatInfo_Renderer_Csv
,
PHP_CompatInfo_Renderer_Xml
,
PHP_CompatInfo_Renderer_Text
,
PHP_CompatInfo_Renderer_Html
,
PHP_CompatInfo_Renderer_Array
,
PHP_CompatInfo_Renderer_Null
) with the
common interface PHP_CompatInfo_Renderer
To create your own renderer or just customize a bit an exists renderer,
please have a look on example named pci180_parsedir_tohtml.php
Here are the list of news and changes since previous API:
Always display result on standard output. To disable this feature, see the FAQ entry About new API 1.8.0.
2 news output format.
With the new renderer system, the Web SAPI may use the
xml
render (until now limited to
CLI). While there is two news render: csv
and html
.
Default output format (PHP dump array) use the array
render while text
is for CLI.
A common method to parse all data
sources. The new method PHP_CompatInfo::parseData
allow to parse
all data source (array, string, file, directory) with the same
interface. All others PHP_CompatInfo::parse* functions become now
alias of this new method (to keep backward compatibility).
Event-driven architecture allow multiple renderer and extending core API of PHP_CompatInfo.
Progress bar for long process. Ability to display simple text wait message or a progress bar when parsing directories (or lot of files) from the command line, and even on web interface.
Constant E_RECOVERABLE_ERROR introduced with PHP 5.2.0, is now detected.
PHP_CompatInfo : The Definitive Guide | v 1.8.0 : August 1, 2008 |