StreamingResponse
in package
FinalYes
Tags
Table of Contents
Methods
- file() : ResponseInterface
- fromGenerator() : ResponseInterface
- ndjson() : ResponseInterface
- Each item becomes one newline-delimited JSON object.
- sse() : ResponseInterface
- Server-Sent Events. Each event is an array with keys: id?, event?, data, retry?.
Methods
file()
public
static file(string $path[, string|null $contentType = null ]) : ResponseInterface
Parameters
- $path : string
- $contentType : string|null = null
Return values
ResponseInterfacefromGenerator()
public
static fromGenerator(Generator $chunks[, int $status = 200 ][, array<string, string> $headers = [] ]) : ResponseInterface
Parameters
- $chunks : Generator
- $status : int = 200
- $headers : array<string, string> = []
Return values
ResponseInterfacendjson()
Each item becomes one newline-delimited JSON object.
public
static ndjson(iterable<string|int, mixed> $items[, callable(mixed): string|null $encoder = null ]) : ResponseInterface
Parameters
- $items : iterable<string|int, mixed>
- $encoder : callable(mixed): string|null = null
-
Custom encoder. Defaults to json_encode.
Tags
Return values
ResponseInterfacesse()
Server-Sent Events. Each event is an array with keys: id?, event?, data, retry?.
public
static sse(iterable<string|int, array{data: string, event?: string, id?: string, retry?: int}> $events) : ResponseInterface
Parameters
- $events : iterable<string|int, array{data: string, event?: string, id?: string, retry?: int}>