| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A beautiful, searchable replacement for phpinfo(). Query PHP configuration programmatically or browse it in a modern UI with dark mode, instant search, and click-to-copy.
composer require stechstudio/phpinfoThe simplest way to use this package is the global prettyphpinfo() function — a drop-in replacement for phpinfo():
prettyphpinfo();That's it. You'll get a pretty, searchable, dark-mode-ready page instead of the default phpinfo() output.
If you're not using a framework with Composer autoloading, you'll need to add require __DIR__ . '/vendor/autoload.php'; first.
Just like the native phpinfo(), you can pass INFO_* constants to control which sections are displayed:
// Only show modules (excludes environment variables — useful for security)
prettyphpinfo(INFO_MODULES);
// Only general information
prettyphpinfo(INFO_GENERAL);
// Combine flags
prettyphpinfo(INFO_GENERAL | INFO_MODULES);You can also use the class-based API directly:
STS\Phpinfo\Info::render();If you're looking to directly inspect and interact with the configuration, capture it first:
use STS\Phpinfo\Info;
$info = Info::capture();
// Or capture a subset
$info = Info::capture(INFO_MODULES);If you have phpinfo() output that you've saved previously and want to load and parse:
use STS\Phpinfo\Info;
// If you've saved the HTML output from phpinfo()
$info = Info::fromHtml($yourSavedHtmlOutput);
// If you've saved the CLI output from phpinfo()
$info = Info::fromText($yourSavedTextOutput);
// Or if you don't know the format, let the package detect it
$info = Info::detect($yourSavedOutput);From here you can query base info, modules, and configs:
// Your PHP version
$info->version(); // "8.5.4"
// Check for the presence of a specific module. Name is case-insensitive.
$info->hasModule('redis'); // true
// Check to see if a specific configuration key is present.
$info->hasConfig('ICU version'); // true
// Retrieve the value for a specific configuration key. If there is both
// a local and master value, the local is returned by default.
$info->config('max_file_uploads'); // "20"
// Pass 'master' to get the php.ini default instead of the effective local value.
$info->config('max_file_uploads', 'master'); // "100"
$info->config('BCMath support', 'master'); // null
// Convenience methods for common lookups
$info->os(); // "Linux"
$info->hostname(); // "my-server"You can iterate over the full data structure to loop over your phpinfo() configuration. All lists (modules(), groups(), configs()) return iterable Items objects with filter(), map(), first(), each(), count(), and more.
// Loop over defined modules
foreach($info->modules() as $module) {
$module->name(); // "session"
// Configs are grouped the same way phpinfo() groups them by table
foreach($module->groups() as $group) {
$group->headings(); // ["Directive", "Local Value", "Master Value"]
foreach($group->configs() as $config) {
$config->name(); // "session.gc_maxlifetime"
$config->localValue(); // "1440"
$config->hasMasterValue(); // true
$config->masterValue(); // "28800"
}
}
}The data structure has four levels:
You can also access configs directly from the Module and PhpInfo levels:
// Flatten grouped configs for a single module
$info->module('session')->configs();
// Flatten ALL configs across all modules
$info->configs();Look up a specific module and inspect it directly:
// Case-insensitive lookup. Returns null if not found.
$module = $info->module('zend opcache');
// Retrieve the name as displayed in phpinfo()
$module->name(); // "Zend OPcache"
// Flatten all configs into one collection
$module->configs()->count(); // 59
// Query a specific config from this module
$module->config('Max keys'); // "16229"
$module->config('opcache.enable_file_override', 'master'); // "Off"
// Access individual groups
$group = $info->module('session')->groups()->first();foreach ($info->modules() as $module) {
echo '<h2>' . $module->name() . '</h2>';
echo '<ul>';
foreach($module->configs() as $config) {
echo '<li>';
echo $config->name() . ': ' . $config->value();
if($config->hasMasterValue()) {
echo ' (master: ' . $config->masterValue() . ')';
}
echo '</li>';
}
echo '</ul>';
}PHP configuration is spread across a bunch of different functions, each with a narrow scope:
All of these require you to know exactly what you're looking for ahead of time. There's no way to discover what's available, iterate over all configuration, or search across modules.
Even if you combine all of them, there are things they simply can't tell you. The configure command PHP was compiled with, Zend extension details, stream wrappers, registered filters, and various per-extension metadata are only available through phpinfo().
phpinfo() is the only function that gives you everything in one place. The problem is it dumps raw HTML (or plain text in CLI) with no API to work with.
This package parses that complete phpinfo() output and gives you:
| Back | FazBrowse Home | New Git URL |