Alpha ZealPHP is early-stage and under active development. APIs may change between minor versions until v1.0. Feedback and bug reports welcome on GitHub.
API Index — Namespaces, Packages, Reports, Indices

PhpInfo
in package

FinalYes

Renders phpinfo() as a self-contained HTML document, restoring Apache+mod_php parity for the CLI SAPI (which otherwise emits a plain-text key => value dump).

Pure renderer: no echo, no global writes. The uopz override target \ZealPHP\phpinfo() echoes render() and returns true.

Robustness: a diagnostics page must never fatal. Request-variable collection is guarded so render() works in any context (request handler, CLI, unit test).

Tags
infection-ignore-all

Presentation-only HTML diagnostics renderer: every method builds an HTML string from env / build / extension / ini state. Its residual mutants are dominated by equivalent string-casts and SAPI/ext/ini-state branches that unit tests cannot exercise both ways. The rendered STRUCTURE is pinned exactly by tests/Unit/PhpInfoTest.php + PhpInfoSectionsTest.php (110 assertions, exact substrings), so it is excluded from mutation SCORING to keep the 92% covered-MSI gate meaningful for real logic rather than HTML concatenation.

Table of Contents

Properties

$moduleText  : string
Boot-captured native phpinfo(INFO_MODULES) text, primed once per worker.

Methods

primeModuleText()  : void
Store the native module-section text captured before the uopz override.
render()  : string
anchor()  : string
Invisible in-page anchor target for the TOC; placed BEFORE a section's <h2>.
collectEnv()  : array<int|string, mixed>
collectRequestVars()  : array<string, array<int|string, mixed>>
document()  : string
e()  : string
iniField()  : string
openswooleVersion()  : string
renderConfiguration()  : string
renderEnvironment()  : string
Process environment table ($_ENV / getenv()). In coroutine/CLI context this may be sparse — that's fine; an empty bag yields a "(no variables)" row rather than a missing section, so the TOC link always resolves.
renderExtensionConfiguration()  : array{0: string, 1: list}
Apache "per-module configuration" detail: one 3-column table per loaded extension that actually exposes ini directives. Mirrors the big stack of per-extension sections in classic phpinfo().
renderGeneral()  : string
renderModules()  : string
renderSystem()  : string
Apache+mod_php "System" table — the canonical top-of-phpinfo build/config block. Every probe is guarded: a diagnostics page must never fatal, so each value degrades to '—' rather than throwing.
renderToc()  : string
Sticky horizontal pill nav linking to each rendered section. The anchor targets are emitted by anchor() just before each section's <h2>, so the existing exact-header assertions on the <h2> tags stay untouched.
renderVariables()  : string
safe()  : string
Run a guarded probe, degrading to '—' on any failure so the diagnostics page can never fatal regardless of SAPI/extension state.
section()  : string
slug()  : string
Stable, URL-safe id for a section title (used by both the TOC link and its anchor).
stringify()  : string
styles()  : string
toArray()  : array<int|string, mixed>

Properties

$moduleText

Boot-captured native phpinfo(INFO_MODULES) text, primed once per worker.

private static string $moduleText = ''

Methods

primeModuleText()

Store the native module-section text captured before the uopz override.

public static primeModuleText(string $text) : void
Parameters
$text : string

render()

public static render([int $flags = INFO_ALL ][, array<string, array<int|string, mixed>>|null $requestVars = null ]) : string
Parameters
$flags : int = INFO_ALL

INFO_* bitmask (matches native phpinfo()).

$requestVars : array<string, array<int|string, mixed>>|null = null

Test seam: ['_GET'=>..., '_POST'=>..., '_COOKIE'=>..., '_SERVER'=>...]. Null pulls from G.

Return values
string

anchor()

Invisible in-page anchor target for the TOC; placed BEFORE a section's <h2>.

private static anchor(string $title) : string
Parameters
$title : string
Return values
string

collectEnv()

private static collectEnv() : array<int|string, mixed>
Return values
array<int|string, mixed>

collectRequestVars()

private static collectRequestVars() : array<string, array<int|string, mixed>>
Return values
array<string, array<int|string, mixed>>

document()

private static document(string $body[, array<int, string> $toc = [] ]) : string
Parameters
$body : string
$toc : array<int, string> = []

Section titles to surface in the in-page nav (already-rendered sections only).

Return values
string

e()

private static e(string $s) : string
Parameters
$s : string
Return values
string

iniField()

private static iniField(array<string|int, mixed> $info, string $key) : string
Parameters
$info : array<string|int, mixed>
$key : string
Return values
string

openswooleVersion()

private static openswooleVersion() : string
Return values
string

renderConfiguration()

private static renderConfiguration() : string
Return values
string

renderEnvironment()

Process environment table ($_ENV / getenv()). In coroutine/CLI context this may be sparse — that's fine; an empty bag yields a "(no variables)" row rather than a missing section, so the TOC link always resolves.

private static renderEnvironment() : string
Return values
string

renderExtensionConfiguration()

Apache "per-module configuration" detail: one 3-column table per loaded extension that actually exposes ini directives. Mirrors the big stack of per-extension sections in classic phpinfo().

private static renderExtensionConfiguration() : array{0: string, 1: list}

Reserved-string contract: section titles are the extension NAME only — they must never contain "Loaded Extensions" or "PHP Variables", which the flag-selectivity tests assert are absent under INFO_CONFIGURATION.

Return values
array{0: string, 1: list}

[html, toc-titles]

renderGeneral()

private static renderGeneral() : string
Return values
string

renderModules()

private static renderModules() : string
Return values
string

renderSystem()

Apache+mod_php "System" table — the canonical top-of-phpinfo build/config block. Every probe is guarded: a diagnostics page must never fatal, so each value degrades to '—' rather than throwing.

private static renderSystem() : string
Return values
string

renderToc()

Sticky horizontal pill nav linking to each rendered section. The anchor targets are emitted by anchor() just before each section's <h2>, so the existing exact-header assertions on the <h2> tags stay untouched.

private static renderToc(array<int, string> $toc) : string
Parameters
$toc : array<int, string>
Return values
string

renderVariables()

private static renderVariables(array<string, array<int|string, mixed>> $vars) : string
Parameters
$vars : array<string, array<int|string, mixed>>
Return values
string

safe()

Run a guarded probe, degrading to '—' on any failure so the diagnostics page can never fatal regardless of SAPI/extension state.

private static safe(callable(): string $probe) : string
Parameters
$probe : callable(): string
Return values
string

section()

private static section(string $title, array<string, string> $rows) : string
Parameters
$title : string
$rows : array<string, string>
Return values
string

slug()

Stable, URL-safe id for a section title (used by both the TOC link and its anchor).

private static slug(string $title) : string
Parameters
$title : string
Return values
string

stringify()

private static stringify(mixed $v) : string
Parameters
$v : mixed
Return values
string

styles()

private static styles() : string
Return values
string

toArray()

private static toArray(mixed $v) : array<int|string, mixed>
Parameters
$v : mixed
Return values
array<int|string, mixed>
On this page