# PhpInfoDataNormalizer

> Narrows the raw phpinfo() HTML output into the typed PHPForge\Debug\PhpInfo\PhpInfoView.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [PhpInfo](/docs/extensions/debug-core/reference/phpinfo/index.md) › PhpInfoDataNormalizer

| final class | `PHPForge\Debug\PhpInfo\PhpInfoDataNormalizer` |
| --- | --- |
| Source | [`src/PhpInfo/PhpInfoDataNormalizer.php`](https://github.com/php-forge/debug-core/blob/main/src/PhpInfo/PhpInfoDataNormalizer.php#L51) |

Narrows the raw [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) HTML output into the typed [`PhpInfoView`](/docs/extensions/debug-core/reference/phpinfo/phpinfoview/index.md).

Splits the captured body into the overview chunk (everything before the first `<h2>`) and the modules chunk (every
module heading + table that follows), parses each `<tr><td>k</td><td>v</td></tr>` pair into a key/value map, builds
the five hero sections ('PHP version' / 'Build' / 'Configuration' / 'Capabilities' / 'Streams') with typed tiles,
and wraps every module `<table>` in the panel's table chrome plus a deep-link `<section>` so the search filter and
the TOC can hide / jump to it.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`capture()`](#method-capture) static | Captures the [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) report of the current process and narrows it into the typed [`PhpInfoView`](/docs/extensions/debug-core/reference/phpinfo/phpinfoview/index.md). | `PhpInfoDataNormalizer` |
| [`fromOutput()`](#method-fromOutput) static | Builds the typed view-model from the raw [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) HTML body, the runtime metrics PHP itself reports (SAPI, OS, memory limit) and the active [`PHP_VERSION`](https://www.php.net/manual/en/reserved.constants.php#constant.php-version) constant. | `PhpInfoDataNormalizer` |

## Method details

### capture() <span id="method-capture"></span>

```php
public static function capture(): PHPForge\Debug\PhpInfo\PhpInfoView
```

Captures the [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) report of the current process and narrows it into the typed [`PhpInfoView`](/docs/extensions/debug-core/reference/phpinfo/phpinfoview/index.md).

**Returns**

[`PhpInfoView`](/docs/extensions/debug-core/reference/phpinfo/phpinfoview/index.md): Typed view-model for the running PHP process.

### fromOutput() <span id="method-fromOutput"></span>

```php
public static function fromOutput(string $body, string $phpVersion, string $sapi, string $os, string $memoryLimit): PHPForge\Debug\PhpInfo\PhpInfoView
```

Builds the typed view-model from the raw [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) HTML body, the runtime metrics PHP itself reports
(SAPI, OS, memory limit) and the active [`PHP_VERSION`](https://www.php.net/manual/en/reserved.constants.php#constant.php-version) constant.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$body` | `string` | Captured `phpinfo()` output, already narrowed to its `<body>` content. |
| `$phpVersion` | `string` | Running PHP version used as the hero headline. |
| `$sapi` | `string` | Server API name. |
| `$os` | `string` | Host operating system description. |
| `$memoryLimit` | `string` | Effective `memory_limit` directive. |

**Returns**

[`PhpInfoView`](/docs/extensions/debug-core/reference/phpinfo/phpinfoview/index.md)