# DebugUrlGenerator

> Builds Yii3 debugger URLs for context-aware panel renderers.

[API reference](/docs/api/index.md) › [Yii3 Debug](/docs/extensions/yii3-debug/reference/index.md) › [Web](/docs/extensions/yii3-debug/reference/web/index.md) › DebugUrlGenerator

| final readonly class | `Yii3\Debug\Web\DebugUrlGenerator` |
| --- | --- |
| Implements | `PHPForge\Debug\Routing\DebugUrlGeneratorInterface` |
| Source | [`src/Web/DebugUrlGenerator.php`](https://github.com/yii3/debug/blob/main/src/Web/DebugUrlGenerator.php#L17) |

Builds Yii3 debugger URLs for context-aware panel renderers.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a URL generator for the normalized debugger route prefix. | `DebugUrlGenerator` |
| [`dbExplain()`](#method-dbExplain) | Builds the URL of the query plan for one stored statement. | `DebugUrlGenerator` |
| [`panel()`](#method-panel) | Builds a panel URL while keeping the captured tag and target panel authoritative. | `DebugUrlGenerator` |
| [`routePrefix()`](#method-routePrefix) | Returns the normalized debugger route prefix. | `DebugUrlGenerator` |

## Method details

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

```php
public function __construct(string $routePrefix = '/debug')
```

Creates a URL generator for the normalized debugger route prefix.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$routePrefix` | `string` | Base path every debugger URL is built on; a trailing slash is trimmed. |

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

```php
public function dbExplain(string $tag, int $sequence): string
```

Builds the URL of the query plan for one stored statement.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tag` | `string` | Capture holding the statement. |
| `$sequence` | `int` | Position of the statement within that capture. |

**Returns**

`string`: URL of the plan page.

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

```php
public function panel(string $tag, string $panel, array<array-key, mixed> $queryParams = []): string
```

Builds a panel URL while keeping the captured tag and target panel authoritative.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$tag` | `string` | Capture to open. |
| `$panel` | `string` | Panel to open within that capture. |
| `$queryParams` | `array<array-key, mixed>` | Extra query parameters; route-owned keys are ignored. |

**Returns**

`string`: URL of the panel view.

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

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

Returns the normalized debugger route prefix.

**Returns**

`string`: Base path without a trailing slash.