phpDocumentor

Response extends ResponseInterface

Interface Response

Table of Contents

__toString()  : string
Convert response to string.
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?
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.
withJson()  : static
Write JSON to Response Body.
withRedirect()  : static
Redirect to specified location
write()  : static
Write data to the response body.

Methods

__toString()

Convert response to string.

public __toString() : string

Note: This method is not part of the PSR-7 standard.

Return values
string

isClientError()

Is this response a client error?

public isClientError() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isEmpty()

Is this response empty?

public isEmpty() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isForbidden()

Is this response forbidden?

public isForbidden() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isInformational()

Is this response informational?

public isInformational() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isNotFound()

Is this response not Found?

public isNotFound() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isOk()

Is this response OK?

public isOk() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isRedirect()

Is this response a redirect?

public isRedirect() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isRedirection()

Is this response a redirection?

public isRedirection() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isServerError()

Is this response a server error?

public isServerError() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

isSuccessful()

Is this response successful?

public isSuccessful() : bool

Note: This method is not part of the PSR-7 standard.

Return values
bool

withFile()

Note: This method is not part of the PSR-7 standard.

public withFile(string|resource|StreamInterface $file[, bool|string $contentType = true ]) : static

This method prepares the response object to return a file response to the client without Content-Disposition header which defaults to inline

You control the behavior of the Content-Type header declaration via $contentType Use a string to override the header to a value of your choice. e.g.: application/json When set to true we attempt to detect the content type using mime_content_type When set to false

Parameters
$file : string|resource|StreamInterface
$contentType : bool|string = true
Tags
throws
RuntimeException

If the file cannot be opened.

throws
InvalidArgumentException

If the mode is invalid.

Return values
static

withFileDownload()

Note: This method is not part of the PSR-7 standard.

public withFileDownload(string|resource|StreamInterface $file[, string|null $name = null ][, bool|string $contentType = true ]) : static

This method will trigger the client to download the specified file It will append the Content-Disposition header to the response object

Parameters
$file : string|resource|StreamInterface
$name : string|null = null
$contentType : bool|string = true
Return values
static

withJson()

Write JSON to Response Body.

public withJson(mixed $data[, int|null $status = null ], int $options[, int $depth = 512 ]) : static

Note: This method is not part of the PSR-7 standard.

This method prepares the response object to return an HTTP Json response to the client.

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

Return values
static

withRedirect()

Redirect to specified location

public withRedirect(string $url[, int|null $status = null ]) : static

Note: This method is not part of the PSR-7 standard.

This method prepares the response object to return an HTTP Redirect response to the client.

Parameters
$url : string

The redirect destination.

$status : int|null = null

The redirect HTTP status code.

Return values
static

write()

Write data to the response body.

public write(string $data) : static

Note: This method is not part of the PSR-7 standard.

Proxies to the underlying stream and writes the provided data to it.

Parameters
$data : string
Return values
static

Search results