HttpResponse
in package
implements
Response
Class HttpResponse
Tags
Interfaces, Classes and Traits
- Response
- Interface Response
Table of Contents
- $internal : Response
- __construct() : mixed
- Response constructor.
- __toString() : string
- Convert response to string.
- getBody() : mixed
- getHeader() : array<string|int, mixed>
- getHeaderLine() : string
- getHeaders() : array<string|int, mixed>
- getProtocolVersion() : string
- getReasonPhrase() : string
- getStatusCode() : int
- hasHeader() : bool
- isClientError() : bool
- Is this response a client error?
- isEmpty() : bool
- Is this response empty?
- isForbidden() : bool
- Is this response forbidden?
- isInformational() : bool
- Is this response informational?
- isNotFound() : bool
- Is this response not Found?
- isOk() : bool
- Is this response OK?
- isRedirect() : bool
- Is this response a redirect?
- isRedirection() : bool
- Is this response a redirection?
- isServerError() : bool
- Is this response a server error?
- isSuccessful() : bool
- Is this response successful?
- toSlimResponse() : Response
- Returns a slim response instance.
- withAddedHeader() : Response
- withBody() : Response
- withFile() : static
- Note: This method is not part of the PSR-7 standard.
- withFileDownload() : static
- Note: This method is not part of the PSR-7 standard.
- withHeader() : Response
- withJson() : static
- Write JSON to Response Body.
- withoutHeader() : Response
- withProtocolVersion() : Response
- withRedirect() : static
- Redirect to specified location
- withStatus() : Response
- write() : static
- Write data to the response body.
Properties
$internal
private
Response
$internal
Methods
__construct()
Response constructor.
public
__construct(Response $internal) : mixed
Parameters
- $internal : Response
Return values
mixed —__toString()
Convert response to string.
public
__toString() : string
Tags
Return values
string —getBody()
public
getBody() : mixed
Tags
Return values
mixed —getHeader()
public
getHeader(mixed $name) : array<string|int, mixed>
Parameters
- $name : mixed
Tags
Return values
array<string|int, mixed> —getHeaderLine()
public
getHeaderLine(mixed $name) : string
Parameters
- $name : mixed
Tags
Return values
string —getHeaders()
public
getHeaders() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getProtocolVersion()
public
getProtocolVersion() : string
Tags
Return values
string —getReasonPhrase()
public
getReasonPhrase() : string
Tags
Return values
string —getStatusCode()
public
getStatusCode() : int
Tags
Return values
int —hasHeader()
public
hasHeader(mixed $name) : bool
Parameters
- $name : mixed
Tags
Return values
bool —isClientError()
Is this response a client error?
public
isClientError() : bool
Tags
Return values
bool —isEmpty()
Is this response empty?
public
isEmpty() : bool
Tags
Return values
bool —isForbidden()
Is this response forbidden?
public
isForbidden() : bool
Tags
Return values
bool —isInformational()
Is this response informational?
public
isInformational() : bool
Tags
Return values
bool —isNotFound()
Is this response not Found?
public
isNotFound() : bool
Tags
Return values
bool —isOk()
Is this response OK?
public
isOk() : bool
Tags
Return values
bool —isRedirect()
Is this response a redirect?
public
isRedirect() : bool
Tags
Return values
bool —isRedirection()
Is this response a redirection?
public
isRedirection() : bool
Tags
Return values
bool —isServerError()
Is this response a server error?
public
isServerError() : bool
Tags
Return values
bool —isSuccessful()
Is this response successful?
public
isSuccessful() : bool
Tags
Return values
bool —toSlimResponse()
Returns a slim response instance.
public
toSlimResponse() : Response
Return values
Response —withAddedHeader()
public
withAddedHeader(mixed $name, mixed $value) : Response
Parameters
- $name : mixed
- $value : mixed
Tags
Return values
Response —withBody()
public
withBody(StreamInterface $body) : Response
Parameters
- $body : StreamInterface
Tags
Return values
Response —withFile()
Note: This method is not part of the PSR-7 standard.
public
withFile(mixed $file[, mixed $contentType = true ]) : static
Parameters
- $file : mixed
- $contentType : mixed = true
Tags
Return values
static —withFileDownload()
Note: This method is not part of the PSR-7 standard.
public
withFileDownload(mixed $file[, string|null $name = null ][, mixed $contentType = true ]) : static
Parameters
- $file : mixed
- $name : string|null = null
- $contentType : mixed = true
Tags
Return values
static —withHeader()
public
withHeader(mixed $name, mixed $value) : Response
Parameters
- $name : mixed
- $value : mixed
Tags
Return values
Response —withJson()
Write JSON to Response Body.
public
withJson(mixed $data[, int|null $status = null ], int $options[, int $depth = 512 ]) : static
Parameters
- $data : mixed
-
The data
- $status : int|null = null
-
The HTTP status code
- $options : int
-
Json encoding options
- $depth : int = 512
-
Json encoding max depth
Tags
Return values
static —withoutHeader()
public
withoutHeader(mixed $name) : Response
Parameters
- $name : mixed
Tags
Return values
Response —withProtocolVersion()
public
withProtocolVersion(mixed $version) : Response
Parameters
- $version : mixed
Tags
Return values
Response —withRedirect()
Redirect to specified location
public
withRedirect(string $url[, int|null $status = null ]) : static
Parameters
- $url : string
-
The redirect destination.
- $status : int|null = null
-
The redirect HTTP status code.
Tags
Return values
static —withStatus()
public
withStatus(mixed $code[, mixed $reasonPhrase = '' ]) : Response
Parameters
- $code : mixed
- $reasonPhrase : mixed = ''
Tags
Return values
Response —write()
Write data to the response body.
public
write(string $data) : static
Parameters
- $data : string