Skip to content
PHP Ecosystem
Explore

RequestSnapshot

API reference › Debug Core › Panel › Request › RequestSnapshot

final readonly classPHPForge\Debug\Panel\Request\RequestSnapshot
ImplementsPHPForge\Debug\Storage\PanelSnapshot
Sourcesrc/Panel/Request/RequestSnapshot.php

Canonical Request panel snapshot.

PropertyTypeDescriptionDefined by
$statusCode readonly constructorintHTTP status code the request completed with.RequestSnapshot
MethodDescriptionDefined by
capture() staticCaptures the Request payload together with the status code it must agree with.RequestSnapshot
data()Returns the payload restored to plain PHP values.RequestSnapshot
fromArray() staticHydrates the Request panel snapshot from decoded JSON data.RequestSnapshot
jsonSerialize()Returns the snapshot for JSON serialization.RequestSnapshot
public static function capture(array<array-key, mixed> $data): self

Captures the Request payload together with the status code it must agree with.

Parameters

ParameterTypeDescription
$dataarray<array-key, mixed>Raw Request payload captured for the request.

Returns

self: Snapshot carrying the tagged payload and its status code.

Throws

public function data(): array<array-key, mixed>

Returns the payload restored to plain PHP values.

Returns

array<array-key, mixed>: Payload restored to plain PHP values.

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

Hydrates the Request panel snapshot from decoded JSON data.

Parameters

ParameterTypeDescription
$datamixedDecoded Request panel payload.
$pathstringPayload path used in hydration errors.

Returns

self: Hydrated Request panel snapshot.

Throws

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

Returns the snapshot for JSON serialization.

Returns

array<string, mixed>: Tagged payload and the status code it agrees with.