interface IResponse

HTTP response interface.

Constants

deprecated PERMANENT

deprecated BROWSER

S100_Continue

HTTP 1.1 response code

S101_SwitchingProtocols

HTTP 1.1 response code

S102_Processing

HTTP 1.1 response code

S200_OK

HTTP 1.1 response code

S201_Created

HTTP 1.1 response code

S202_Accepted

HTTP 1.1 response code

S203_NonAuthoritativeInformation

HTTP 1.1 response code

S204_NoContent

HTTP 1.1 response code

S205_ResetContent

HTTP 1.1 response code

S206_PartialContent

HTTP 1.1 response code

S207_MultiStatus

HTTP 1.1 response code

S208_AlreadyReported

HTTP 1.1 response code

S226_ImUsed

HTTP 1.1 response code

S300_MultipleChoices

HTTP 1.1 response code

S301_MovedPermanently

HTTP 1.1 response code

S302_Found

HTTP 1.1 response code

S303_PostGet

HTTP 1.1 response code

S304_NotModified

HTTP 1.1 response code

S305_UseProxy

HTTP 1.1 response code

S307_TemporaryRedirect

HTTP 1.1 response code

S308_PermanentRedirect

HTTP 1.1 response code

S400_BadRequest

HTTP 1.1 response code

S401_Unauthorized

HTTP 1.1 response code

S402_PaymentRequired

HTTP 1.1 response code

S403_Forbidden

HTTP 1.1 response code

S404_NotFound

HTTP 1.1 response code

S405_MethodNotAllowed

HTTP 1.1 response code

S406_NotAcceptable

HTTP 1.1 response code

S407_ProxyAuthenticationRequired

HTTP 1.1 response code

S408_RequestTimeout

HTTP 1.1 response code

S409_Conflict

HTTP 1.1 response code

S410_Gone

HTTP 1.1 response code

S411_LengthRequired

HTTP 1.1 response code

S412_PreconditionFailed

HTTP 1.1 response code

S413_RequestEntityTooLarge

HTTP 1.1 response code

S414_RequestUriTooLong

HTTP 1.1 response code

S415_UnsupportedMediaType

HTTP 1.1 response code

S416_RequestedRangeNotSatisfiable

HTTP 1.1 response code

S417_ExpectationFailed

HTTP 1.1 response code

S421_MisdirectedRequest

HTTP 1.1 response code

S422_UnprocessableEntity

HTTP 1.1 response code

S423_Locked

HTTP 1.1 response code

S424_FailedDependency

HTTP 1.1 response code

S426_UpgradeRequired

HTTP 1.1 response code

S428_PreconditionRequired

HTTP 1.1 response code

S429_TooManyRequests

HTTP 1.1 response code

S431_RequestHeaderFieldsTooLarge

HTTP 1.1 response code

S451_UnavailableForLegalReasons

HTTP 1.1 response code

S500_InternalServerError

HTTP 1.1 response code

S501_NotImplemented

HTTP 1.1 response code

S502_BadGateway

HTTP 1.1 response code

S503_ServiceUnavailable

HTTP 1.1 response code

S504_GatewayTimeout

HTTP 1.1 response code

S505_HttpVersionNotSupported

HTTP 1.1 response code

S506_VariantAlsoNegotiates

HTTP 1.1 response code

S507_InsufficientStorage

HTTP 1.1 response code

S508_LoopDetected

HTTP 1.1 response code

S510_NotExtended

HTTP 1.1 response code

S511_NetworkAuthenticationRequired

HTTP 1.1 response code

ReasonPhrases

SameSiteLax

SameSite cookie

SameSiteStrict

SameSite cookie

SameSiteNone

SameSite cookie

deprecated REASON_PHRASES

deprecated SAME_SITE_LAX

deprecated SAME_SITE_STRICT

deprecated SAME_SITE_NONE

deprecated S100_CONTINUE

deprecated S101_SWITCHING_PROTOCOLS

deprecated S102_PROCESSING

deprecated S201_CREATED

deprecated S202_ACCEPTED

deprecated S203_NON_AUTHORITATIVE_INFORMATION

deprecated S204_NO_CONTENT

deprecated S205_RESET_CONTENT

deprecated S206_PARTIAL_CONTENT

deprecated S207_MULTI_STATUS

deprecated S208_ALREADY_REPORTED

deprecated S226_IM_USED

deprecated S300_MULTIPLE_CHOICES

deprecated S301_MOVED_PERMANENTLY

deprecated S302_FOUND

deprecated S303_SEE_OTHER

deprecated S303_POST_GET

deprecated S304_NOT_MODIFIED

deprecated S305_USE_PROXY

deprecated S307_TEMPORARY_REDIRECT

deprecated S308_PERMANENT_REDIRECT

deprecated S400_BAD_REQUEST

deprecated S401_UNAUTHORIZED

deprecated S402_PAYMENT_REQUIRED

deprecated S403_FORBIDDEN

deprecated S404_NOT_FOUND

deprecated S405_METHOD_NOT_ALLOWED

deprecated S406_NOT_ACCEPTABLE

deprecated S407_PROXY_AUTHENTICATION_REQUIRED

deprecated S408_REQUEST_TIMEOUT

deprecated S409_CONFLICT

deprecated S410_GONE

deprecated S411_LENGTH_REQUIRED

deprecated S412_PRECONDITION_FAILED

deprecated S413_REQUEST_ENTITY_TOO_LARGE

deprecated S414_REQUEST_URI_TOO_LONG

deprecated S415_UNSUPPORTED_MEDIA_TYPE

deprecated S416_REQUESTED_RANGE_NOT_SATISFIABLE

deprecated S417_EXPECTATION_FAILED

deprecated S421_MISDIRECTED_REQUEST

deprecated S422_UNPROCESSABLE_ENTITY

deprecated S423_LOCKED

deprecated S424_FAILED_DEPENDENCY

deprecated S426_UPGRADE_REQUIRED

deprecated S428_PRECONDITION_REQUIRED

deprecated S429_TOO_MANY_REQUESTS

deprecated S431_REQUEST_HEADER_FIELDS_TOO_LARGE

deprecated S451_UNAVAILABLE_FOR_LEGAL_REASONS

deprecated S500_INTERNAL_SERVER_ERROR

deprecated S501_NOT_IMPLEMENTED

deprecated S502_BAD_GATEWAY

deprecated S503_SERVICE_UNAVAILABLE

deprecated S504_GATEWAY_TIMEOUT

deprecated S505_HTTP_VERSION_NOT_SUPPORTED

deprecated S506_VARIANT_ALSO_NEGOTIATES

deprecated S507_INSUFFICIENT_STORAGE

deprecated S508_LOOP_DETECTED

deprecated S510_NOT_EXTENDED

deprecated S511_NETWORK_AUTHENTICATION_REQUIRED

Methods

setCode(int $code, string|null $reason = null)

Sets HTTP response code.

int
getCode()

Returns HTTP response code.

setHeader(string $name, string $value)

Sends a HTTP header and replaces a previous one.

addHeader(string $name, string $value)

Adds HTTP header.

setContentType(string $type, string|null $charset = null)

Sends a Content-type HTTP header.

void
redirect(string $url, int $code = self::S302_Found)

Redirects to a new URL.

setExpiration(string|null $expire)

Sets the time (like '20 minutes') before a page cached on a browser expires, null means "must-revalidate".

bool
isSent()

Checks if headers have been sent.

string|null
getHeader(string $header)

Returns value of an HTTP header.

array
getHeaders()

Returns an associative array of headers to sent.

setCookie(string $name, string $value, string|int|DateTimeInterface $expire, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool|null $httpOnly = null)

Sends a cookie.

deleteCookie(string $name, string|null $path = null, string|null $domain = null, bool|null $secure = null)

Deletes a cookie.

self
deleteHeader(string $name)

No description

Details

at line 348
IResponse setCode(int $code, string|null $reason = null)

Sets HTTP response code.

Parameters

int $code
string|null $reason

Return Value

IResponse

at line 353
int getCode()

Returns HTTP response code.

Return Value

int

at line 359
IResponse setHeader(string $name, string $value)

Sends a HTTP header and replaces a previous one.

Parameters

string $name
string $value

Return Value

IResponse

at line 365
IResponse addHeader(string $name, string $value)

Adds HTTP header.

Parameters

string $name
string $value

Return Value

IResponse

at line 371
IResponse setContentType(string $type, string|null $charset = null)

Sends a Content-type HTTP header.

Parameters

string $type
string|null $charset

Return Value

IResponse

at line 376
void redirect(string $url, int $code = self::S302_Found)

Redirects to a new URL.

Parameters

string $url
int $code

Return Value

void

at line 382
IResponse setExpiration(string|null $expire)

Sets the time (like '20 minutes') before a page cached on a browser expires, null means "must-revalidate".

Parameters

string|null $expire

Return Value

IResponse

at line 387
bool isSent()

Checks if headers have been sent.

Return Value

bool

at line 392
string|null getHeader(string $header)

Returns value of an HTTP header.

Parameters

string $header

Return Value

string|null

at line 397
array getHeaders()

Returns an associative array of headers to sent.

Return Value

array

at line 404
IResponse setCookie(string $name, string $value, string|int|DateTimeInterface $expire, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool|null $httpOnly = null)

Sends a cookie.

Parameters

string $name
string $value
string|int|DateTimeInterface $expire

time, value null means "until the browser session ends"

string|null $path
string|null $domain
bool|null $secure
bool|null $httpOnly

Return Value

IResponse

at line 417
deleteCookie(string $name, string|null $path = null, string|null $domain = null, bool|null $secure = null)

Deletes a cookie.

Parameters

string $name
string|null $path
string|null $domain
bool|null $secure

at line 17
self deleteHeader(string $name)

No description

Parameters

string $name

Return Value

self