# ProviderPanel

> Adapts any provider-owned declarative panel to the Yii3 debugger.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Panel](/docs/extensions/yii3-debug/reference/panel/index.md) › ProviderPanel

| class | `Yii3\Debug\Panel\ProviderPanel` |
| --- | --- |
| Implements | [`ToolbarPanelProviderInterface`](/docs/extensions/yii3-debug/reference/panel/toolbarpanelproviderinterface/index.md) |
| Source | [`src/Panel/ProviderPanel.php`](https://github.com/yii3/debug/blob/main/src/Panel/ProviderPanel.php#L18) |

3 subclasses:

- [`AssetPanel`](/docs/extensions/yii3-debug/reference/panel/assetpanel/index.md)
- [`MailPanel`](/docs/extensions/yii3-debug/reference/panel/mailpanel/index.md)
- [`UserPanel`](/docs/extensions/yii3-debug/reference/panel/userpanel/index.md)

Adapts any provider-owned declarative panel to the Yii3 debugger.

The presentation is built on first use and memoized for the payload it was built from, so the listing check, the
toolbar metrics, and the detail page of one capture share a single provider call.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates an adapter for a provider-owned declarative panel. | `ProviderPanel` |
| [`hasContent()`](#method-hasContent) | Returns whether the capture holds a presentation for this panel. | `ProviderPanel` |
| [`icon()`](#method-icon) | Returns the shared Debug Core icon key. | `ProviderPanel` |
| [`id()`](#method-id) | Returns the stable identifier of this panel. | `ProviderPanel` |
| [`name()`](#method-name) | Returns the human-readable panel name. | `ProviderPanel` |
| [`render()`](#method-render) | Renders the detail content the provider produces for a capture. | `ProviderPanel` |
| [`toolbarItems()`](#method-toolbarItems) | Builds the toolbar metrics the provider declares for a capture. | `ProviderPanel` |
| [`withMetadata()`](#method-withMetadata) | Returns a copy presenting the panel under the metadata the application configured. | `ProviderPanel` |

## Method details

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

```php
public function __construct(PHPForge\Debug\Panel $provider)
```

Creates an adapter for a provider-owned declarative panel.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$provider` | `PHPForge\Debug\Panel` | Declarative panel supplying the identity and presentation. |

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

```php
public function hasContent(array<string, mixed> $payload): bool
```

Returns whether the capture holds a presentation for this panel.

An extension the application enabled stays listed even on a capture where it recorded no activity, so its own
empty state explains the idle capture instead of the entry disappearing from the sidebar. Building the
presentation here keeps a failing provider discoverable, because the failure reaches the host, and it primes
the memo the toolbar and the detail page read next.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` | Serialized panel payload. |

**Returns**

`bool`: `true`, since the host only asks once the capture carries this panel's payload.

**Throws**

- [`Throwable`](https://www.php.net/manual/en/class.throwable.php): if the provider cannot present the payload.

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

```php
public function icon(): string
```

Returns the shared Debug Core icon key.

**Returns**

`string`: Effective icon key, falling back to the provider default.

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

```php
public function id(): string
```

Returns the stable identifier of this panel.

**Returns**

`string`: Stable panel ID declared by the provider.

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

```php
public function name(): string
```

Returns the human-readable panel name.

**Returns**

`string`: Effective display name, falling back to the provider default.

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

```php
public function render(Yii3\Debug\Panel\PanelRenderInput $input): string
```

Renders the detail content the provider produces for a capture.

Only the payload reaches the provider, so the portable presentation stays independent of the host request.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$input` | [`PanelRenderInput`](/docs/extensions/yii3-debug/reference/panel/panelrenderinput/index.md) | Payload, request context, and request summary of the page being rendered. |

**Returns**

`string`: Rendered detail content.

**Throws**

- [`Throwable`](https://www.php.net/manual/en/class.throwable.php): if the provider cannot present the payload.

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

```php
public function toolbarItems(array<string, mixed> $payload): list<PHPForge\Debug\Toolbar\ToolbarItem>
```

Builds the toolbar metrics the provider declares for a capture.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` | Serialized panel payload. |

**Returns**

`list<PHPForge\Debug\Toolbar\ToolbarItem>`: Toolbar metrics declared by the provider.

**Throws**

- [`Throwable`](https://www.php.net/manual/en/class.throwable.php): if the provider cannot present the payload.

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

```php
public function withMetadata(string $title, string $icon): self
```

Returns a copy presenting the panel under the metadata the application configured.

The detail heading, the sidebar entry, and the toolbar chip all read the effective title, so the panel keeps
one name across the debugger while [`ProviderPanel::id()`](/docs/extensions/yii3-debug/reference/panel/providerpanel/index.md#method-id) stays the stable capture key.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$title` | `string` | Effective display title. |
| `$icon` | `string` | Effective icon key. |

**Returns**

`self`: Adapter presenting the configured metadata, with an empty memo.