MailSnapshot
API reference › Debug Core › Panel › Mail › MailSnapshot
Canonical Mail panel snapshot holding the captured messages in their typed form.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a mail snapshot from captured messages. | MailSnapshot |
capture() static | Narrows the captured EVENT_AFTER_SEND payloads into typed messages. | MailSnapshot |
entries() | Returns the captured messages. | MailSnapshot |
fromArray() static | Narrows the persisted mail payload into a typed snapshot. | MailSnapshot |
jsonSerialize() | Serializes the snapshot into its persisted payload. | MailSnapshot |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(list<PHPForge\Debug\Panel\Mail\MailEntry> $entries)Creates a mail snapshot from captured messages.
Parameters
| Parameter | Type | Description |
|---|---|---|
$entries | list<MailEntry> | Captured messages in send order. |
capture()
Section titled “capture() ”public static function capture(array<array-key, mixed> $messages): selfNarrows the captured EVENT_AFTER_SEND payloads into typed messages.
Parameters
| Parameter | Type | Description |
|---|---|---|
$messages | array<array-key, | Captured payloads in send order; non-array entries are dropped. |
Returns
self: Snapshot carrying the typed messages.
entries()
Section titled “entries() ”public function entries(): list<PHPForge\Debug\Panel\Mail\MailEntry>Returns the captured messages.
Returns
list<MailEntry>: Captured messages in send order.
fromArray()
Section titled “fromArray() ”public static function fromArray(mixed $data, string $path): selfNarrows the persisted mail payload into a typed snapshot.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Persisted payload, expected to be an object carrying an entries list. |
$path | string | JSON path of the payload, used to report a malformed capture. |
Returns
self: Snapshot carrying the persisted messages.
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array<string, mixed>Serializes the snapshot into its persisted payload.
Returns
array<string, mixed>: Payload carrying the messages under the entries key.