class Response implements ResponseInterface (View source)

Methods

static Response
getInstance()

Get response

string|null
getContent()

Get response message

int
getCode()

Get status code

array
getHeaders()

Get headers

setContent(string $content)

Get response message

withHeaders(array $headers)

Get headers

addHeader(string $key, string $value)

Modify http headers

string
download(string $file, string|null $filename = null, string $disposition = 'attachment', array $headers = [])

Download the given file as an argument

status(int $code)

Modify http headers

string
json(mixed $data, int $code = 200, array $headers = [])

JSON response

string
send(mixed $data, int $code = 200, array $headers = [])

Equivalent to an echo, except that it ends the application

string
render(string $template, array $data = [], int $code = 200, array $headers = [])

Make view rendering

serverAccessControl()

Get accessControl instance

void
sendContent()

No description

Details

static Response getInstance()

Get response

Return Value

Response

string|null getContent()

Get response message

Return Value

string|null

int getCode()

Get status code

Return Value

int

array getHeaders()

Get headers

Return Value

array

Response setContent(string $content)

Get response message

Parameters

string $content

Return Value

Response

Response withHeaders(array $headers)

Get headers

Parameters

array $headers

Return Value

Response

Response addHeader(string $key, string $value)

Modify http headers

Parameters

string $key
string $value

Return Value

Response

string download(string $file, string|null $filename = null, string $disposition = 'attachment', array $headers = [])

Download the given file as an argument

Parameters

string $file
string|null $filename
string $disposition
array $headers

Return Value

string

Response status(int $code)

Modify http headers

Parameters

int $code

Return Value

Response

string json(mixed $data, int $code = 200, array $headers = [])

JSON response

Parameters

mixed $data
int $code
array $headers

Return Value

string

string send(mixed $data, int $code = 200, array $headers = [])

Equivalent to an echo, except that it ends the application

Parameters

mixed $data
int $code
array $headers

Return Value

string

string render(string $template, array $data = [], int $code = 200, array $headers = [])

Make view rendering

Parameters

string $template
array $data
int $code
array $headers

Return Value

string

Exceptions

ServerAccessControl serverAccessControl()

Get accessControl instance

Return Value

ServerAccessControl

void sendContent()

No description

Return Value

void