Skip to content
docsv0.1.0

LiveHttpResponse

The HTTP-transport-agnostic response envelope for a live interaction — a status code plus a JSON-serializable body, constructed only via {@see ok()} or {@see error()} so every response carries the `ok` flag the client-side runtime branches on.

LiveHttpResponse::ok()

public static function ok(array $body): self

A 200 success response; `$body` is merged after `'ok' => true`.

Parameters

Parameters of ok()
NameTypeDescription
$bodyarray<string, mixed>

LiveHttpResponse::error()

public static function error(int $status, string $code, string $message, array $details = []): self

An `'ok' => false` error response for the given HTTP `$status`, a machine-readable `$code`, a human-readable `$message`, and optional structured `$details`.

Parameters

Parameters of error()
NameTypeDescription
$statusint
$codestring
$messagestring
$detailsarray<string, mixed>