Response
in package
Table of Contents
- $body : mixed
- $headers : mixed
- $headersSent : mixed
- $rendered : mixed
- $status : mixed
- $instance : mixed
- addHeader() : Response
- Add a header to be sent in the response.
- addHeaders() : Response
- Add a list of headers to be sent in the response.
- body() : string|Response
- Set the body of the response or return the current body.
- clear() : Response
- Reset the status, header and body of the response.
- end() : void
- Exit the application
- get() : Response
- Get the current instance or create one
- hasRendered() : bool
- Flag if the response has already rendered content
- json() : Response
- Shortcut to send a json response
- redirect() : void
- Send redirect headers to the browser and stop the application
- resetInstance() : Response
- Re-create the current instance
- send() : void
- Send the response to the client
- sendHeaders() : Response
- Send the headers collection to the client
- status() : Response
- Get or set the status of the response.
- __construct() : mixed
Properties
$body
public
mixed
$body
$headers
public
mixed
$headers
= []
$headersSent
public
mixed
$headersSent
= false
$rendered
public
mixed
$rendered
= false
$status
public
mixed
$status
= 200
$instance
protected
static mixed
$instance
Methods
addHeader()
Add a header to be sent in the response.
public
addHeader(mixed $name, mixed $value) : Response
Parameters
- $name : mixed
- $value : mixed
Return values
Response —addHeaders()
Add a list of headers to be sent in the response.
public
addHeaders(array<string|int, mixed> $headers) : Response
Parameters
- $headers : array<string|int, mixed>
Return values
Response —body()
Set the body of the response or return the current body.
public
body([mixed $content = null ]) : string|Response
Parameters
- $content : mixed = null
Return values
string|Response —clear()
Reset the status, header and body of the response.
public
clear() : Response
Return values
Response —end()
Exit the application
public
end() : void
Return values
void —get()
Get the current instance or create one
public
static get() : Response
Return values
Response —hasRendered()
Flag if the response has already rendered content
public
hasRendered() : bool
Return values
bool —json()
Shortcut to send a json response
public
json([array<string|int, mixed> $data = [] ]) : Response
Parameters
- $data : array<string|int, mixed> = []
Return values
Response —redirect()
Send redirect headers to the browser and stop the application
public
redirect(string $url) : void
Parameters
- $url : string
Return values
void —resetInstance()
Re-create the current instance
public
static resetInstance() : Response
Return values
Response —send()
Send the response to the client
public
send([string $body = '' ]) : void
Parameters
- $body : string = ''
Return values
void —sendHeaders()
Send the headers collection to the client
public
sendHeaders() : Response
Return values
Response —status()
Get or set the status of the response.
public
status([mixed $code = null ]) : Response
Parameters
- $code : mixed = null
Return values
Response —__construct()
protected
__construct() : mixed