Stream
Stream
Stream response class.
class Stream extends \Hazaar\Controller\Response\HTTP\OKExtends: Hazaar\Controller\Response\HTTP\OK
This response emits lightweight framed stream packets for incremental output. Payloads can represent plain strings, arrays encoded as JSON, or exception details encoded as structured error packets.
Packet framing uses a one-byte type marker and content payload, with writePacket() additionally prefixing a hexadecimal payload length.
Properties
type
Stream packet type marker.
private string $type = 's'Type: string
Known values are:
sfor plain string payloadsafor array/JSON payloadsefor error payloads
Methods
__construct
public __construct(array|\Exception|string $data): voidParameters
| Parameter | Type | Description |
|---|---|---|
$data | array | Exception |
writePacket
Write a framed stream packet with a hexadecimal length prefix.
public writePacket(): voidReturns: void
Packet format: <hex-length>\0<type><payload>. The output buffers are flushed immediately to support streaming clients.
writeOutput
Write the stream payload without a length prefix.
public writeOutput(): voidReturns: void
Packet format: \0<type><payload>.
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000