Documentation

ResponseMaker

Response Maker Trait Stores attributes the can be used to prepare a response from the server.

Tags
author

Alexey Bobkov, Samuel Georges

Table of Contents

$responseHeaderBag  : ResponseHeaderBag
$responseOverride  : mixed
$statusCode  : int
getResponseHeaders()  : ResponseHeaderBag|null
Get the header response bag
getStatusCode()  : int
Returns the status code for the current web response.
makeResponse()  : mixed
Prepares a response that considers overrides and custom responses.
setResponse()  : $this
Sets the response for the current page request cycle, this value takes priority over the standard response prepared by the controller.
setResponseCookie()  : $this
Add a cookie to the response.
setResponseHeader()  : $this
Set a header on the Response.
setStatusCode()  : $this
Sets the status code for the current web response.

Properties

$responseHeaderBag

protected ResponseHeaderBag $responseHeaderBag = null

$responseOverride

protected mixed $responseOverride = null

Override the standard controller response.

$statusCode

protected int $statusCode = 200

Response status code

Methods

getResponseHeaders()

Get the header response bag

public getResponseHeaders() : ResponseHeaderBag|null
Return values
ResponseHeaderBag|null

getStatusCode()

Returns the status code for the current web response.

public getStatusCode() : int
Return values
int

Status code

makeResponse()

Prepares a response that considers overrides and custom responses.

public makeResponse(mixed $contents) : mixed
Parameters
$contents : mixed
Return values
mixed

setResponse()

Sets the response for the current page request cycle, this value takes priority over the standard response prepared by the controller.

public setResponse(mixed $response) : $this
Parameters
$response : mixed

Response object or string

Return values
$this

setResponseCookie()

Add a cookie to the response.

public setResponseCookie(Cookie|mixed $cookie) : $this
Parameters
$cookie : Cookie|mixed
Return values
$this

setResponseHeader()

Set a header on the Response.

public setResponseHeader(string $key, array<string|int, mixed>|string $values[, bool $replace = true ]) : $this
Parameters
$key : string
$values : array<string|int, mixed>|string
$replace : bool = true
Return values
$this

setStatusCode()

Sets the status code for the current web response.

public setStatusCode(int $code) : $this
Parameters
$code : int

Status code

Return values
$this

Search results