# PanelRegistration

> Represents the host registration metadata of one debug panel.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Registration](/docs/extensions/debug-core/reference/registration/index.md) › PanelRegistration

| final readonly class | `PHPForge\Debug\Registration\PanelRegistration` |
| --- | --- |
| Source | [`src/Registration/PanelRegistration.php`](https://github.com/php-forge/debug-core/blob/main/src/Registration/PanelRegistration.php#L20) |

Represents the host registration metadata of one debug panel.

The ID is the stable association with captured data, so renaming a panel through [`PanelRegistration::withOverride()`](/docs/extensions/debug-core/reference/registration/panelregistration/index.md#method-withOverride) never
changes the stored key or any URL.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-extension"></span>`$extension` readonly constructor | `bool` | `true` when the host groups the panel under its Extensions menu; `false` for a built-in. | `PanelRegistration` |
| <span id="property-icon"></span>`$icon` readonly constructor | `string` | Icon key, or `''` when the panel has no icon. | `PanelRegistration` |
| <span id="property-id"></span>`$id` readonly constructor | `string` | Stable panel identifier, never normalized. | `PanelRegistration` |
| <span id="property-position"></span>`$position` readonly constructor | `int\|null` | Sort weight among extensions, or `null` to order the entry by title. Default: `null`. | `PanelRegistration` |
| <span id="property-title"></span>`$title` readonly constructor | `string` | Display title. | `PanelRegistration` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Validates the registration metadata and rejects an ID that is empty or padded with whitespace. | `PanelRegistration` |
| [`builtIn()`](#method-builtIn) static | Creates a registration for a host built-in panel, which keeps its fixed display order. | `PanelRegistration` |
| [`extension()`](#method-extension) static | Creates a registration for a provider-owned panel, which the host groups under its Extensions menu. | `PanelRegistration` |
| [`withOverride()`](#method-withOverride) | Returns a copy with the configured title, icon, and position applied. | `PanelRegistration` |

## Method details

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

```php
public function __construct(string $id, string $title, string $icon, bool $extension, int|null $position = null)
```

Validates the registration metadata and rejects an ID that is empty or padded with whitespace.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `string` | Stable panel identifier, never normalized. |
| `$title` | `string` | Display title. |
| `$icon` | `string` | Icon key, or `''` when the panel has no icon. |
| `$extension` | `bool` | `true` when the host groups the panel under its Extensions menu; `false` for a built-in. |
| `$position` | `int\|null` | Sort weight among extensions, or `null` to order the entry by title. |

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): When the ID, the title, or the icon key is invalid.

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

```php
public static function builtIn(string $id, string $title, string $icon): self
```

Creates a registration for a host built-in panel, which keeps its fixed display order.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `string` | Stable panel identifier. |
| `$title` | `string` | Provider default title. |
| `$icon` | `string` | Provider default icon key, or `''` when the panel has no icon. |

**Returns**

`self`: Built-in registration.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): When the ID, the title, or the icon key is invalid.

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

```php
public static function extension(string $id, string $title, string $icon): self
```

Creates a registration for a provider-owned panel, which the host groups under its Extensions menu.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$id` | `string` | Stable panel identifier. |
| `$title` | `string` | Provider default title. |
| `$icon` | `string` | Provider default icon key, or `''` when the panel has no icon. |

**Returns**

`self`: Extension registration.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): When the ID, the title, or the icon key is invalid.

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

```php
public function withOverride(PHPForge\Debug\Registration\PanelOverride $override): self
```

Returns a copy with the configured title, icon, and position applied.

Values the override leaves `null` keep the provider default.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$override` | [`PanelOverride`](/docs/extensions/debug-core/reference/registration/paneloverride/index.md) | Application configuration for this panel. |

**Returns**

`self`: Registration carrying the effective metadata.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): When the override sets a position on a built-in panel.