Response
extends Response
in package
implements
ResponseInterface
Simple Response Implementation.
Table of Contents
Interfaces
- ResponseInterface
- Describes Response interface.
Methods
- fileAttachment() : static
- Return an instance with provided attachment disposition response.
- fileInline() : static
- Return an instance with provided inline disposition response.
- html() : static
- Return an instance with provided text/html response.
- json() : static
- Return an instance with provided application/json response.
- plain() : static
- Return an instance with provided text/plain response.
- redirect() : static
- Return an instance with provided redirect response.
- xml() : static
- Return an instance with provided text/xml response.
- file() : static
- Return an instance with provided file response.
- response() : static
- Generate PSR-7 response.
Methods
fileAttachment()
Return an instance with provided attachment disposition response.
public
fileAttachment(string $path[, string $filename = '' ]) : static
Parameters
- $path : string
-
File path
- $filename : string = ''
-
Filename
Return values
staticfileInline()
Return an instance with provided inline disposition response.
public
fileInline(string $path[, string $filename = '' ]) : static
Parameters
- $path : string
-
File path
- $filename : string = ''
-
Filename
Return values
statichtml()
Return an instance with provided text/html response.
public
html(string $markUp[, int $status = 200 ]) : static
Parameters
- $markUp : string
-
Response content
- $status : int = 200
-
Response status
Return values
staticjson()
Return an instance with provided application/json response.
public
json(array<string|int, mixed> $data[, bool $prettyPrint = false ][, int $status = 200 ]) : static
Parameters
- $data : array<string|int, mixed>
-
Response content
- $prettyPrint : bool = false
-
Response pretty print
- $status : int = 200
-
Response status
Return values
staticplain()
Return an instance with provided text/plain response.
public
plain(string $text[, int $status = 200 ]) : static
Parameters
- $text : string
-
Response content
- $status : int = 200
-
Response status
Return values
staticredirect()
Return an instance with provided redirect response.
public
redirect(string $url[, bool $permanent = false ]) : static
Parameters
- $url : string
-
Location redirect
- $permanent : bool = false
-
Permanent redirect
Return values
staticxml()
Return an instance with provided text/xml response.
public
xml(SimpleXMLElement $xml[, int $status = 200 ]) : static
Parameters
- $xml : SimpleXMLElement
-
Response content
- $status : int = 200
-
Response status
Return values
staticfile()
Return an instance with provided file response.
private
file(string $disposition, string $path[, string $filename = '' ]) : static
Parameters
- $disposition : string
-
Disposition type
- $path : string
-
File path
- $filename : string = ''
-
Filename
Return values
staticresponse()
Generate PSR-7 response.
private
response(string $body[, int $status = 200 ][, array<string, string> $header = [] ]) : static
Parameters
- $body : string
-
Response content
- $status : int = 200
-
Response status
- $header : array<string, string> = []
-
Response header