SapiEmitter
in package
Responsible for emitting a PSR-7 Response to the SAPI.
Table of Contents
- BUFFER_SIZE = 8192
- emit() : void
- Emit headers and body from the provided PSR-7 response.
- emitBody() : void
- Emit the body of the response to the browser/client in chunks.
- emitHeaders() : void
- Sends HTTP headers based on the provided response object and configuration.
Constants
BUFFER_SIZE
private
mixed
BUFFER_SIZE
= 8192
Methods
emit()
Emit headers and body from the provided PSR-7 response.
public
emit(ResponseInterface $response[, bool $replaceByDefault = false ][, array<string|int, mixed> $appendHeaders = ['set-cookie'] ]) : void
Parameters
- $response : ResponseInterface
-
The finalized response.
- $replaceByDefault : bool = false
-
Whether to replace existing headers by default. Headers not listed in
$appendHeaders
will follow this behavior. Defaults to false. - $appendHeaders : array<string|int, mixed> = ['set-cookie']
-
An array of header names (case-insensitive) for which multiple values should be appended instead of replacing. Defaults to ['set-cookie'].
Return values
void —emitBody()
Emit the body of the response to the browser/client in chunks.
public
emitBody(ResponseInterface $response) : void
Parameters
- $response : ResponseInterface
-
The finalized response.
Return values
void —emitHeaders()
Sends HTTP headers based on the provided response object and configuration.
public
emitHeaders(ResponseInterface $response[, bool $replaceByDefault = false ][, array<string|int, mixed> $appendHeaders = ['set-cookie'] ]) : void
Emits the status line as well as all headers from the response. Supports
appending values for specific headers (e.g., "Set-Cookie") if specified
via $appendHeaders
; otherwise follows $replaceByDefault
.
Parameters
- $response : ResponseInterface
-
The response object containing headers to emit.
- $replaceByDefault : bool = false
-
Whether to replace existing headers by default.
- $appendHeaders : array<string|int, mixed> = ['set-cookie']
-
An array of header names (case-insensitive) for which multiple values should be appended.