Methods

setCookie()

setCookie(string  $name, mixed  $value, integer  $expire, string  $path = null, string  $domain = null, boolean  $secure = false, boolean  $httponly = true) : static

Sets a cookie to be sent at the end of the request

Parameters

string $name
mixed $value
integer $expire
string $path
string $domain
boolean $secure
boolean $httponly

Returns

static

deleteCookie()

deleteCookie(string  $name, string  $path = null, string  $domain = null, boolean  $secure = false, boolean  $httponly = true) : static

Deletes a cookie by its name

Parameters

string $name
string $path
string $domain
boolean $secure
boolean $httponly

Returns

static

setStatus()

setStatus(integer  $code, string  $text = null) : static

Sets the HTTP response code

Parameters

integer $code
string $text

Returns

static

getStatus()

getStatus() : string

Returns

string

getStatusCode()

getStatusCode() : integer

Returns

integer

getStatusText()

getStatusText(integer  $code = null) : string

Parameters

integer $code

Returns

string

setHeader()

setHeader(string  $name, string  $value) : static

send a header in the response

Parameters

string $name
string $value

Returns

static

getHeader()

getHeader(string  $name, string  $default = null) : string

Parameters

string $name
string $default

Returns

string

hasHeader()

hasHeader(string  $name) : boolean

Parameters

string $name

Returns

boolean

removeHeader()

removeHeader(string  $name) : static

Parameters

string $name

Returns

static

setExpires()

setExpires(integer  $timestamp) : static

Sets output expire time header

Parameters

integer $timestamp

Returns

static

setNotModified()

setNotModified() : static

Sends a Not-Modified response

Returns

static

setETag()

setETag(  $etag) 

Parameters

$etag

setCacheControl()

setCacheControl(string  $control) : static

Parameters

string $control

Returns

static

setMaxAge()

setMaxAge(integer  $age, string  $extra = null) : static

Parameters

integer $age
string $extra

Returns

static

setContentType()

setContentType(string  $contentType, string  $charset = null) : static

Sets the response content-type mime, optionally the charset

Parameters

string $contentType
string $charset

Returns

static

getContentType()

getContentType() : string

Returns

string

redirect()

redirect(string|array  $location, boolean  $temporarily = true) : static

Redirect by HTTP to another action or URL

Parameters

string|array $location
boolean $temporarily

Returns

static

setContent()

setContent(string  $content) : static

Sets HTTP response body

Parameters

string $content

Returns

static

setJsonOk()

setJsonOk(string  $message = '') : static

Parameters

string $message

Returns

static

setJsonError()

setJsonError(string  $message, integer  $code = 1) : static

Parameters

string $message
integer $code

Returns

static

setJsonData()

setJsonData(mixed  $data, string  $message = '') : static

Parameters

mixed $data
string $message

Returns

static

setJsonContent()

setJsonContent(array|\JsonSerializable|string|\Exception  $content) : static

Sets HTTP response body. The parameter is automatically converted to JSON

Parameters

array|\JsonSerializable|string|\Exception $content

Returns

static

getContent()

getContent() : string

Gets the HTTP response body

Returns

string

setFile()

setFile(string  $file, string  $attachmentName = null) : static

Sets an attached file to be sent at the end of the request

Parameters

string $file
string $attachmentName

Returns

static

getFile()

getFile() : string|null

Returns

string|null

setAttachment()

setAttachment(string  $attachmentName) : static

Parameters

string $attachmentName

Returns

static

setCsvContent()

setCsvContent(array  $rows, string  $name, array|string  $header = null) : static

Parameters

array $rows
string $name
array|string $header

Returns

static

getHeaders()

getHeaders() : array

Returns

array