几天内即可获得 Laravel 代码审查方面的专家指导

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

发布日期 经过

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:

使用 STS\Phpinfo\Info ;
$info = 信息 :: 捕获 ();
$info -> 版本 (); // "8.4.19"
$info -> hasModule 'mysqli' (英文): // 真的
$info -> 配置 'post_max_size' (英文): // "32M" (local/effective value)
$info -> 配置 'post_max_size' , 'master' (英文): // "2M" (php.ini default)
$info -> os (); // "Linux"
$info -> 主机名 (); // "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() , 和 count() :

foreach ($info -> 模块 () 作为 $module) {
回声 '<h2>' $module -> 姓名 () '</h2>' ;
foreach ($module -> 配置 () 作为 $config) {
回声 $配置 -> 姓名 () ':' $配置 -> 价值 ();
如果 ($config -> hasMasterValue ()){
回声 ' (master: ' $配置 -> 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 = 信息 :: fromHtml ($savedHtmlOutput);
$info = 信息 :: 来自文本 ($savedTextOutput);
$info = 信息 :: detect ($savedOutput); // auto-detects format

安装

Requires PHP 8.3+ and ext-dom

作曲家 要求 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 的照片

Laravel News 的特约撰稿人和全栈 Web 开发人员。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
Jump24 - 英国 Laravel 代理机构

Laravel 开发人员,精通技术,绝不外包,绝不离岸外包,始终卓越。

访问 Jump24 - 英国 Laravel 代理机构
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
MongoDB 徽标

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB
Laravel Starter Kits Now Include Toast Notifications image

Laravel Starter Kits Now Include Toast Notifications

阅读文章
Ship AI with Laravel: Stop Your AI Agent from Guessing image

Ship AI with Laravel: Stop Your AI Agent from Guessing

阅读文章
Laravel Cloud Adds Path Blocking to Prevent Bots From Waking Hibernated Apps image

Laravel Cloud Adds Path Blocking to Prevent Bots From Waking Hibernated Apps

阅读文章
Making Laravel MongoDB Operations Idempotent: Safe Retries for Financial Transactions image

Making Laravel MongoDB Operations Idempotent: Safe Retries for Financial Transactions

阅读文章
FormRequest Strict Mode and Queue Job Inspection in Laravel 13.4.0 image

FormRequest Strict Mode and Queue Job Inspection in Laravel 13.4.0

阅读文章
Pretty PHP Info: A Modern Replacement for `phpinfo()` image

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

阅读文章