# DebugSnapshot

> Represents the versioned envelope persisted for one captured request.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Storage](/docs/extensions/debug-core/reference/storage/index.md) › DebugSnapshot

| final readonly class | `PHPForge\Debug\Storage\DebugSnapshot` |
| --- | --- |
| Implements | [`JsonSerializable`](https://www.php.net/manual/en/class.jsonserializable.php) |
| Source | [`src/Storage/DebugSnapshot.php`](https://github.com/php-forge/debug-core/blob/main/src/Storage/DebugSnapshot.php#L14) |

Represents the versioned envelope persisted for one captured request.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-failures"></span>`$failures` readonly constructor | `array<string,` [`PanelFailure`](/docs/extensions/debug-core/reference/storage/panelfailure/index.md)`>` | Panel failures indexed by panel ID. | `DebugSnapshot` |
| <span id="property-panels"></span>`$panels` readonly constructor | `array<string, array<string, mixed>>` | Serialized panel payloads indexed by panel ID. | `DebugSnapshot` |
| <span id="property-summary"></span>`$summary` readonly constructor | [`RequestSummary`](/docs/extensions/debug-core/reference/storage/requestsummary/index.md) | Captured request metadata. | `DebugSnapshot` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a versioned envelope for a captured request. | `DebugSnapshot` |
| [`fromArray()`](#method-fromArray) static | Hydrates a versioned request envelope from decoded JSON data. | `DebugSnapshot` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the request envelope for JSON serialization. | `DebugSnapshot` |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-VERSION"></span>`VERSION` | `4` |  | `DebugSnapshot` |

## Method details

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

```php
public function __construct(PHPForge\Debug\Storage\RequestSummary $summary, array<string, array<string, mixed>> $panels, array<string, PHPForge\Debug\Storage\PanelFailure> $failures)
```

Creates a versioned envelope for a captured request.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$summary` | [`RequestSummary`](/docs/extensions/debug-core/reference/storage/requestsummary/index.md) | Captured request metadata. |
| `$panels` | `array<string, array<string, mixed>>` | Serialized panel payloads indexed by panel ID. |
| `$failures` | `array<string,` [`PanelFailure`](/docs/extensions/debug-core/reference/storage/panelfailure/index.md)`>` | Panel failures indexed by panel ID. |

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

```php
public static function fromArray(mixed $data): self
```

Hydrates a versioned request envelope from decoded JSON data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `mixed` | Decoded snapshot envelope. |

**Returns**

`self`: Hydrated request snapshot.

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

```php
public function jsonSerialize(): array<string, mixed>
```

Returns the request envelope for JSON serialization.

**Returns**

`array<string, mixed>`: Versioned request envelope.