# PanelRenderContext

> Supplies request, theme, and adapter-owned URL state to a framework-neutral panel renderer.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › PanelRenderContext

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

Supplies request, theme, and adapter-owned URL state to a framework-neutral panel renderer.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-panel"></span>`$panel` readonly constructor | `string` | Stable identifier of the panel being rendered. | `PanelRenderContext` |
| <span id="property-queryParams"></span>`$queryParams` readonly constructor | `array<array-key, mixed>` | Parsed query parameters of the current debugger request. | `PanelRenderContext` |
| <span id="property-tag"></span>`$tag` readonly constructor | `string` | Captured request tag. | `PanelRenderContext` |
| <span id="property-theme"></span>`$theme` readonly constructor | `string` | Resolved debugger theme. | `PanelRenderContext` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates the request, theme, and URL context for a panel renderer. | `PanelRenderContext` |
| [`panelPayload()`](#method-panelPayload) | Returns another panel payload from the current snapshot when cross-panel composition is required. | `PanelRenderContext` |
| [`panelUrl()`](#method-panelUrl) | Builds a panel URL for this captured request. | `PanelRenderContext` |

## Method details

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

```php
public function __construct(string $tag, string $panel, array<array-key, mixed> $queryParams, string $theme, PHPForge\Debug\Routing\DebugUrlGeneratorInterface $urls, array<string, array<string, mixed>> $panels = [])
```

Creates the request, theme, and URL context for a panel renderer.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tag` | `string` | Captured request tag. |
| `$panel` | `string` | Stable identifier of the panel being rendered. |
| `$queryParams` | `array<array-key, mixed>` | Parsed query parameters of the current debugger request. |
| `$theme` | `string` | Resolved debugger theme. |
| `$urls` | [`PHPForge\Debug\Routing\DebugUrlGeneratorInterface`](/docs/extensions/debug-core/reference/routing/debugurlgeneratorinterface/index.md) | Adapter-owned URL generator. |
| `$panels` | `array<string, array<string, mixed>>` | Serialized panel payloads from the current snapshot. |

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

```php
public function panelPayload(string $panel): array<string, mixed>|null
```

Returns another panel payload from the current snapshot when cross-panel composition is required.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$panel` | `string` |  |

**Returns**

`array<string, mixed>|null`: Serialized panel payload, or `null` when it was not captured.

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

```php
public function panelUrl(string|null $panel = null, array<array-key, mixed>|null $queryParams = null): string
```

Builds a panel URL for this captured request.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$panel` | `string\|null` | Target panel, or `null` to keep the current panel. |
| `$queryParams` | `array<array-key, mixed>\|null` | Panel parameters, or `null` to reuse the current query. |

**Returns**

`string`