0 follower

Final Class Yiisoft\PsrEmitter\SapiEmitter

InheritanceYiisoft\PsrEmitter\SapiEmitter
ImplementsYiisoft\PsrEmitter\EmitterInterface

SapiEmitter sends a response using standard PHP Server API, i.e., with {@see header()} and "echo".

Constants

Hide inherited constants

Constant Value Description Defined By
DEFAULT_BUFFER_SIZE 8388608 Yiisoft\PsrEmitter\SapiEmitter

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( integer|null $bufferSize null )
$bufferSize integer|null

The size of the buffer in bytes to send the content of the message body.

                public function __construct(?int $bufferSize = null)
{
    if ($bufferSize !== null && $bufferSize < 1) {
        throw new InvalidArgumentException('Buffer size must be greater than zero.');
    }
    $this->bufferSize = $bufferSize ?? self::DEFAULT_BUFFER_SIZE;
}

            
emit() public method

public void emit ( \Psr\Http\Message\ResponseInterface $response )
$response \Psr\Http\Message\ResponseInterface

                public function emit(ResponseInterface $response): void
{
    $this->emitHeaders($response);
    /**
     * Sends headers before the body.
     * Makes a client possible to recognize the type of the body content if it is sent with a delay,
     * for instance, for a streamed response.
     */
    flush();
    $this->emitBody($response);
}