# ShellContext

> Typed view-model for the debugger shell (brand bar + sidebar + main wrapper).

[API reference](/docs/api/index.md) › [Debug](/docs/extensions/debug/reference/index.md) › [widgets](/docs/extensions/debug/reference/widgets/index.md) › [shell](/docs/extensions/debug/reference/widgets/shell/index.md) › ShellContext

| final readonly class | `yii\debug\widgets\shell\ShellContext` |
| --- | --- |
| Source | [`src/widgets/shell/ShellContext.php`](https://github.com/yii2-extensions/debug/blob/main/src/widgets/shell/ShellContext.php#L15) |

Typed view-model for the debugger shell (brand bar + sidebar + main wrapper).

The `$mode` discriminator picks the panel, history, or bare layout. The controller supplies fully normalized header
and sidebar data so the layout only renders this object.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-configUrl"></span>`$configUrl` readonly constructor | `string\|null` | Configuration-chip URL on the brand bar; `null` when no manifest entry is available (chip renders disabled). | `ShellContext` |
| <span id="property-debugThemeAttributes"></span>`$debugThemeAttributes` readonly constructor | `array<string, string>` | Document attributes applied to `<html>`, including the language and resolved light/dark theme. | `ShellContext` |
| <span id="property-mode"></span>`$mode` readonly constructor | `string` | Shell mode ('view' / 'index' / 'bare'). | `ShellContext` |
| <span id="property-peakMemory"></span>`$peakMemory` readonly constructor | `string\|null` | Formatted peak memory ('X.XX MB'); `null` when no captured summary is present. | `ShellContext` |
| <span id="property-phpVersion"></span>`$phpVersion` readonly constructor | `string` | PHP version label shown in the brand bar. | `ShellContext` |
| <span id="property-resolvedTheme"></span>`$resolvedTheme` readonly constructor | `string` | Resolved theme ('dark' / 'light') fed to the shell header for the toggle button. | `ShellContext` |
| <span id="property-sidebar"></span>`$sidebar` readonly constructor | `PHPForge\Debug\View\Sidebar\SidebarView\|null` | Sidebar view-model, or `null` for bare pages. | `ShellContext` |
| <span id="property-themeIconMoon"></span>`$themeIconMoon` readonly constructor | `string` | Pre-rendered moon glyph for the theme-toggle button. | `ShellContext` |
| <span id="property-themeIconSun"></span>`$themeIconSun` readonly constructor | `string` | Pre-rendered sun glyph for the theme-toggle button. | `ShellContext` |
| <span id="property-title"></span>`$title` readonly constructor | `string` | Document `<title>` already escaped. | `ShellContext` |
| <span id="property-useShell"></span>`$useShell` readonly constructor | `bool` | `true` when the shell layout (brand bar + sidebar) should render; `false` for 'bare' which echoes raw content into `<body>`. | `ShellContext` |
| <span id="property-yiiVersion"></span>`$yiiVersion` readonly constructor | `string` | Yii framework version label shown in the brand bar. | `ShellContext` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Collects the prepared content and presentation state for a debugger page. | `ShellContext` |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-MODE_BARE"></span>`MODE_BARE` | `'bare'` | Mode that echoes raw content into `<body>` without the brand bar or sidebar. | `ShellContext` |
| <span id="const-MODE_INDEX"></span>`MODE_INDEX` | `'index'` | Mode of the history grid, where the sidebar navigator acts as a cursor over the captured requests. | `ShellContext` |
| <span id="const-MODE_VIEW"></span>`MODE_VIEW` | `'view'` | Mode of a panel view, where the sidebar highlights the active panel of the inspected request. | `ShellContext` |

## Method details

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

```php
public function __construct(string $mode, bool $useShell, string $title, array $debugThemeAttributes, string $resolvedTheme, string $themeIconSun, string $themeIconMoon, string $yiiVersion, string $phpVersion, string|null $peakMemory, string|null $configUrl, PHPForge\Debug\View\Sidebar\SidebarView|null $sidebar)
```

Collects the prepared content and presentation state for a debugger page.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$mode` | `string` |  |
| `$useShell` | `bool` |  |
| `$title` | `string` |  |
| `$debugThemeAttributes` | `array` |  |
| `$resolvedTheme` | `string` |  |
| `$themeIconSun` | `string` |  |
| `$themeIconMoon` | `string` |  |
| `$yiiVersion` | `string` |  |
| `$phpVersion` | `string` |  |
| `$peakMemory` | `string\|null` |  |
| `$configUrl` | `string\|null` |  |
| `$sidebar` | `PHPForge\Debug\View\Sidebar\SidebarView\|null` |  |