# PhpInfoModuleGroup

> Groups phpinfo() modules by the job they perform.

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

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

Groups [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) modules by the job they perform.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`bucket()`](#method-bucket) static | Buckets items by the group owning their module title, keeping every label in TOC display order with [`OTHER`](/docs/extensions/debug-core/reference/phpinfo/phpinfomodulegroup/index.md#const-OTHER) last. Groups nothing lands in stay empty rather than disappearing, so callers decide whether to skip them. | `PhpInfoModuleGroup` |
| [`isExtension()`](#method-isExtension) static | Whether the module describes a PHP extension rather than a reporting block. | `PhpInfoModuleGroup` |
| [`resolve()`](#method-resolve) static | Returns the group label owning the module, or [`OTHER`](/docs/extensions/debug-core/reference/phpinfo/phpinfomodulegroup/index.md#const-OTHER) when the module is unknown. | `PhpInfoModuleGroup` |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-ENVIRONMENT"></span>`ENVIRONMENT` | `'Environment'` | Reporting blocks that [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) emits as modules but that describe the environment, not an extension. | `PhpInfoModuleGroup` |
| <span id="const-OTHER"></span>`OTHER` | `'Other'` | Bucket for unknown and third-party modules. | `PhpInfoModuleGroup` |

## Method details

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

```php
public static function bucket(list<PHPForge\Debug\PhpInfo\T> $items, callable(PHPForge\Debug\PhpInfo\T): string $title): array<string, list<PHPForge\Debug\PhpInfo\T>>
```

Buckets items by the group owning their module title, keeping every label in TOC display order with
[`OTHER`](/docs/extensions/debug-core/reference/phpinfo/phpinfomodulegroup/index.md#const-OTHER) last. Groups nothing lands in stay empty rather than disappearing, so callers decide whether to
skip them.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$items` | `list<PHPForge\Debug\PhpInfo\T>` | Items to bucket. |
| `$title` | `callable(PHPForge\Debug\PhpInfo\T): string` | Reads the module title from an item. |

**Returns**

`array<string, list<PHPForge\Debug\PhpInfo\T>>`: Items per group label.

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

```php
public static function isExtension(string $title): bool
```

Whether the module describes a PHP extension rather than a reporting block.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$title` | `string` | Module title reported by [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php). |

**Returns**

`bool`

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

```php
public static function resolve(string $title): string
```

Returns the group label owning the module, or [`OTHER`](/docs/extensions/debug-core/reference/phpinfo/phpinfomodulegroup/index.md#const-OTHER) when the module is unknown.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$title` | `string` | Module title reported by [`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php). |

**Returns**

`string`