Emits a Response to the PHP Server API.
This emitter offers a few changes from the emitters offered by diactoros:
int
Maximum output buffering size for each iteration.
Constructor
Emit a response.
Emit the message body.
Emit a range of the message body.
Emit cookies using setcookie()
Emit response headers.
Emit the status line.
Loops through the output buffer, flushing each, before emitting the response.
Parse content-range header https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
Helper methods to set cookie.
__construct(int $maxBufferLength = 8192)
Constructor
int
$maxBufferLength optional Maximum output buffering size for each iteration.
emit(ResponseInterface $response): bool
Emit a response.
Emits a response, including status line, headers, and the message body, according to the environment.
ResponseInterface
$response The response to emit.
bool
emitBody(Psr\Http\Message\ResponseInterface $response): void
Emit the message body.
Psr\Http\Message\ResponseInterface
$response The response to emit
void
emitBodyRange(array $range, Psr\Http\Message\ResponseInterface $response): void
Emit a range of the message body.
array
$range The range data to emit
Psr\Http\Message\ResponseInterface
$response The response to emit
void
emitCookies(arrayCake\Http\Cookie\CookieInterface|string> $cookies): void
Emit cookies using setcookie()
arrayCake\Http\Cookie\CookieInterface|string>
$cookies An array of cookies.
void
emitHeaders(Psr\Http\Message\ResponseInterface $response): void
Emit response headers.
Loops through each header, emitting each; if the header value is an array with multiple values, ensures that each is sent in such a way as to create aggregate headers (instead of replace the previous).
Psr\Http\Message\ResponseInterface
$response The response to emit
void
emitStatusLine(Psr\Http\Message\ResponseInterface $response): void
Emit the status line.
Emits the status line using the protocol version and status code from the response; if a reason phrase is available, it, too, is emitted.
Psr\Http\Message\ResponseInterface
$response The response to emit
void
flush(int|null $maxBufferLevel = null): void
Loops through the output buffer, flushing each, before emitting the response.
int|null
$maxBufferLevel optional Flush up to this buffer level.
void
parseContentRange(string $header): array|false
Parse content-range header https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
string
$header The Content-Range header to parse.
array|false
setCookie(Cake\Http\Cookie\CookieInterface|string $cookie): bool
Helper methods to set cookie.
Cake\Http\Cookie\CookieInterface|string
$cookie Cookie.
bool
Maximum output buffering size for each iteration.
int
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Http.ResponseEmitter.html