You can easily roll your own using ini_get_all and get_loaded_extensions. Since you want users to be able to check whether their server meets the requirements for your package, you can run the checks in a script, rather than forcing users to pour over lists of extensions, configuration options and other info.
pkginfo.php:
PHP Code:
<?php
$package = array(
'name' => 'Foonly Sprockets',
'minPHPVer' => '5.0.2',
/* an array in 'required' is a list of alternates; any one of
them will satisfy the extension requirement. Basically,
requirements are in conjunctive normal form.
*/
'required' => array('Zend Optimizer',
array('PDO', 'mysqli'))
);?>
reqschecks.php:
PHP Code:
<?php
include('pkgInfo.php');
if (version_compare(PHP_VERSION, $package['minPHPVer'], '<')){
$failures['version'] = "At least PHP $package[minPHPVer] is required (you have "
. PHP_VERSION . ").";
}
$loaded = get_loaded_extensions();
$missing = array_diff($package['required'], $loaded);
foreach ($missing as $i => $ext) {
if (is_array($ext)) {
if (array_intersect($ext, $loaded)) {
unset($missing[$i]);
} else {
$missing[$i] = 'one of: ' . implode(', ', $ext) . ';';
}
}
}
if ($missing) {
$failures['extensions'] = "Your host is missing the following PHP extensions required for this package: "
. implode(', ', $missing);
}?>
compatibility.php:
PHP Code:
<p>Running compatibility checks. If you see no results, your server doesn't have PHP installed and is thus incompatible.</p>
<?php
include('reqschecks.php');
if ($failures) {
?><p>Your server isn't compatible with <?php
if (False) { ?>this package<?php }
echo $package['name'];
?>. Reasons:</p>
<ul>
<li><?php
// the following is only visible if this file isn't processed by PHP
if (False) { ?>PHP isn't installed.<?php }
echo implode("</li>\n<li>", $failures);
?></li>
</ul><?php
} else {
// use echo so that no output is produced if PHP isn't installed
echo "<p>Your server is compatible with $package[name].</p>";
}