PART is a PHP Applications Requirements Tester.
PART allows you to check if the hosting server meets application requirements.
Using PART is very simple - you only invoke tests for what you need.
Many of the tests may check version e.g. extension. If you want to check a version you should put it in "PHP-standardized" version number strings (see http://www.php.net/manual/en/function.version-compare.php) as parameter of test.
If you want to check version you can specify the operator by using defined class constants. You can see a list of available operators below:
PART::COMPARE_EQUALPART::COMPARE_NOT_EQUALPART::COMPARE_GREATER_THANPART::COMPARE_GREATER_THAN_OR_EQUALPART::COMPARE_LESS_THANPART::COMPARE_LESS_THAN_OR_EQUAL
You can see a list of current available tests below:
- check PHP version
- check loaded extension
- check PHP configurations value
- check disabled_functions and disabled_classes
- check extensions: MySQL, MySQLi, PostgreSQL, PDO are loaded
- check PDO drivers
- check Windows on host
- check IonCube extension
- check Magic Quotes
- check default Time Zone
Reports define behaviour of PART after all tests. PART has a built-in 3 kind of report.
You can define the type of reports which you want to obtain using constructor parameter:
$part = new PART(new DataReport());
If you do not specify a kind of report, PART will decide itself basing the decision on the run environment.
ConsoleReport generates a human-readable report for viewing in the console. This type is default for CLI environments.
WebReport generates a report as a HTML for viewing in web browser. This type is default for invoking by web browser.
DataReport only stores objects array of results tests. Object DataReport implements Iterator interface, so you can use it with foreach. The second way to use the results is to invoke getArray() for getting a pure array.
DataReport stores only results of tests in an object and does not generate human-readable reports. For using this type you have to create it and pass it by parameter to PART constructor. Additionaly, you have to add generateReport() to invoke the function after the last test.
Jacek Skirzyński, http://skirzynski.eu/