Pretty PHP Info: A Modern Replacement for `phpinfo()`

Published on by

Pretty PHP Info is a package by Joseph Szobody of Signature Tech Studio that replaces the default phpinfo() output with a modern, searchable UI — and adds a PHP API for querying your PHP configuration programmatically.

The simplest way to use it is the prettyphpinfo() drop-in function:

prettyphpinfo();

That swaps out the default output for a dark-mode-ready page with instant search and click-to-copy values. You can pass the same INFO_* constants as phpinfo() to filter which sections are shown:

// Only show modules (useful for hiding environment variables)
prettyphpinfo(INFO_MODULES);
 
// Combine flags
prettyphpinfo(INFO_GENERAL | INFO_MODULES);

Querying PHP Configuration Programmatically

Beyond the UI, the package gives you an API to inspect your PHP configuration in code. Capture the output with Info::capture() and then query it:

use STS\Phpinfo\Info;
 
$info = Info::capture();
 
$info->version(); // "8.4.19"
$info->hasModule('mysqli'); // true
$info->config('post_max_size'); // "32M" (local/effective value)
$info->config('post_max_size', 'master'); // "2M" (php.ini default)
$info->os(); // "Linux"
$info->hostname(); // "my-server"

One notable capability is fetching both the local (effective) value and the master (php.ini default) for any directive — something ini_get() alone can't do.

Why Not Just Use ini_get()?

PHP scatters its configuration across several functions — ini_get(), extension_loaded(), get_loaded_extensions(), phpversion() — and each one only tells you one specific thing. None of them let you discover what's available, iterate over all configuration, or see phpinfo()-only data like compile options, stream wrappers, and registered filters.

phpinfo() is the only function that gives you everything in one place, but it outputs raw HTML or plain text with no API to work with. This package parses that output and exposes it through a consistent interface.

Iterating Over Configuration

You can also walk the full configuration structure. Modules, groups, and configs are returned as iterable Items collections with filter(), map(), first(), each(), and count():

foreach ($info->modules() as $module) {
echo '<h2>' . $module->name() . '</h2>';
 
foreach ($module->configs() as $config) {
echo $config->name() . ': ' . $config->value();
if ($config->hasMasterValue()) {
echo ' (master: ' . $config->masterValue() . ')';
}
}
}

The data structure mirrors how phpinfo() organizes things: PhpInfomodules()groups()configs(). You can also flatten and access configs directly from any level.

You can load previously saved phpinfo() output as well:

$info = Info::fromHtml($savedHtmlOutput);
$info = Info::fromText($savedTextOutput);
$info = Info::detect($savedOutput); // auto-detects format

Installation

Requires PHP 8.3+ and ext-dom.

composer require stechstudio/phpinfo

You can view the source code for the package on GitHub or learn more on the official website at prettyphpinfo.com.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Code Review

Get expert guidance in a few days with a Laravel code review

Visit Laravel Code Review
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech

The latest

View all →
JSON Schema Deserialization in Laravel 13.14 image

JSON Schema Deserialization in Laravel 13.14

Read article
Generate Short, URL-Safe IDs From Numbers With Sqids image

Generate Short, URL-Safe IDs From Numbers With Sqids

Read article
Scheduler List: A Web Dashboard for Laravel's Scheduled Tasks image

Scheduler List: A Web Dashboard for Laravel's Scheduled Tasks

Read article
Community Laravel Extension for Zed image

Community Laravel Extension for Zed

Read article
Advanced Eloquent Query Filtering with Filterable image

Advanced Eloquent Query Filtering with Filterable

Read article
Bulk Job Dispatching with Bus::bulk() in Laravel 13.13 image

Bulk Job Dispatching with Bus::bulk() in Laravel 13.13

Read article