# EventSnapshot

> Canonical Event panel snapshot holding the captured rows in their typed form.

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

| final readonly class | `PHPForge\Debug\Panel\Event\EventSnapshot` |
| --- | --- |
| Implements | [`PHPForge\Debug\Storage\PanelSnapshot`](/docs/extensions/debug-core/reference/storage/panelsnapshot/index.md) |
| Source | [`src/Panel/Event/EventSnapshot.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Event/EventSnapshot.php#L14) |

Canonical Event panel snapshot holding the captured rows in their typed form.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a snapshot from the captured event rows. | `EventSnapshot` |
| [`entries()`](#method-entries) | Returns the captured event rows. | `EventSnapshot` |
| [`fromArray()`](#method-fromArray) static | Hydrates the Event panel snapshot from decoded JSON data. | `EventSnapshot` |
| [`jsonSerialize()`](#method-jsonSerialize) | Returns the snapshot for JSON serialization. | `EventSnapshot` |

## Method details

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

```php
public function __construct(list<PHPForge\Debug\Panel\Event\EventRow> $entries)
```

Creates a snapshot from the captured event rows.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$entries` | `list<`[`EventRow`](/docs/extensions/debug-core/reference/panel/event/eventrow/index.md)`>` | Captured rows in fire order. |

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

```php
public function entries(): list<PHPForge\Debug\Panel\Event\EventRow>
```

Returns the captured event rows.

**Returns**

`list<`[`EventRow`](/docs/extensions/debug-core/reference/panel/event/eventrow/index.md)`>`: Captured rows in fire order.

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

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

Hydrates the Event panel snapshot from decoded JSON data.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$data` | `mixed` | Decoded Event panel payload. |
| `$path` | `string` | Payload path used in hydration errors. |

**Returns**

`self`: Hydrated snapshot carrying the typed rows.

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

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

Returns the snapshot for JSON serialization.

**Returns**

`array<string, mixed>`: Serialized event rows in fire order.