final class ResponseBuilder (View source)

Methods

__construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)
ResponseInterface
text(string $content, int $status = 200)
ResponseInterface
ResponseInterface
html(string $content, int $status = 200)
ResponseInterface
ResponseInterface
json(array $payload, int $status = 200)
ResponseInterface
ResponseInterface
redirect(string $to, int $status = 302)
ResponseInterface
ResponseInterface
download(string $filePath, string|null $downloadName = null, string $contentType = 'application/octet-stream')
ResponseInterface
ResponseInterface
response(string $content = '', int $status = 200, string $contentType = 'text/html; charset=UTF-8')
ResponseInterface
ResponseInterface
stream(callable $producer, int $status = 200, string $contentType = 'text/plain; charset=UTF-8', array $headers = [])
ResponseInterface

Details

__construct

__construct(ResponseFactoryInterface $responseFactory, StreamFactoryInterface $streamFactory)

No description

Parameters

ResponseFactoryInterface $responseFactory
StreamFactoryInterface $streamFactory

text

ResponseInterface text(string $content, int $status = 200)

No description

Parameters

string $content
int $status

Return Value

ResponseInterface

html

ResponseInterface html(string $content, int $status = 200)

No description

Parameters

string $content
int $status

Return Value

ResponseInterface

json

ResponseInterface json(array $payload, int $status = 200)

No description

Parameters

array $payload
int $status

Return Value

ResponseInterface

redirect

ResponseInterface redirect(string $to, int $status = 302)

No description

Parameters

string $to
int $status

Return Value

ResponseInterface

download

ResponseInterface download(string $filePath, string|null $downloadName = null, string $contentType = 'application/octet-stream')

No description

Parameters

string $filePath
string|null $downloadName
string $contentType

Return Value

ResponseInterface

response

ResponseInterface response(string $content = '', int $status = 200, string $contentType = 'text/html; charset=UTF-8')

No description

Parameters

string $content
int $status
string $contentType

Return Value

ResponseInterface

stream

ResponseInterface stream(callable $producer, int $status = 200, string $contentType = 'text/plain; charset=UTF-8', array $headers = [])

No description

Parameters

callable $producer
int $status
string $contentType
array $headers

Return Value

ResponseInterface