Aplus Framework Docs

Status
in package

Class Status.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Table of Contents

ACCEPTED  = 202
202 Accepted.
ALREADY_REPORTED  = 208
208 Already Reported (WebDAV).
BAD_GATEWAY  = 502
502 Bad Gateway.
BAD_REQUEST  = 400
400 Bad Request.
CLIENT_CLOSED_REQUEST  = 499
499 Client Closed Request (nginx).
CONFLICT  = 409
409 Conflict.
CONTINUE  = 100
100 Continue.
CREATED  = 201
201 Created.
EARLY_HINTS  = 103
103 Early Hints.
EXPECTATION_FAILED  = 417
417 Expectation Failed.
FAILED_DEPENDENCY  = 424
424 Failed Dependency (WebDAV).
FORBIDDEN  = 403
403 Forbidden.
FOUND  = 302
302 Found.
GATEWAY_TIMEOUT  = 504
504 Gateway Timeout.
GONE  = 410
410 Gone.
HTTP_VERSION_NOT_SUPPORTED  = 505
505 HTTP Version Not Supported.
IM_A_TEAPOT  = 418
418 I'm a teapot.
IM_USED  = 226
226 IM Used (HTTP Delta encoding).
INSUFFICIENT_STORAGE  = 507
507 Insufficient Storage (WebDAV).
INTERNAL_SERVER_ERROR  = 500
500 Internal Server Error.
LENGTH_REQUIRED  = 411
411 Length Required.
LOCKED  = 423
423 Locked (WebDAV).
LOOP_DETECTED  = 508
508 Loop Detected (WebDAV).
METHOD_NOT_ALLOWED  = 405
405 Method Not Allowed.
MISDIRECTED_REQUEST  = 421
421 Misdirected Request.
MOVED_PERMANENTLY  = 301
301 Moved Permanently.
MULTI_STATUS  = 207
207 Multi-Status (WebDAV).
MULTIPLE_CHOICES  = 300
300 Multiple Choices.
NETWORK_AUTHENTICATION_REQUIRED  = 511
511 Network Authentication Required.
NETWORK_CONNECT_TIMEOUT_ERROR  = 599
599 Network Connect Timeout Error.
NO_CONTENT  = 204
204 No Content.
NON_AUTHORITATIVE_INFORMATION  = 203
203 Non-Authoritative Information.
NOT_ACCEPTABLE  = 406
406 Not Acceptable.
NOT_EXTENDED  = 510
510 Not Extended.
NOT_FOUND  = 404
404 Not Found.
NOT_IMPLEMENTED  = 501
501 Not Implemented.
NOT_MODIFIED  = 304
304 Not Modified.
OK  = 200
200 OK.
PARTIAL_CONTENT  = 206
206 Partial Content.
PAYLOAD_TOO_LARGE  = 413
413 Payload Too Large.
PAYMENT_REQUIRED  = 402
402 Payment Required.
PERMANENT_REDIRECT  = 308
308 Permanent Redirect.
PRECONDITION_FAILED  = 412
412 Precondition Failed.
PRECONDITION_REQUIRED  = 428
428 Precondition Required.
PROCESSING  = 102
102 Processing (WebDAV).
PROXY_AUTHENTICATION_REQUIRED  = 407
407 Proxy Authentication Required.
RANGE_NOT_SATISFIABLE  = 416
416 Range Not Satisfiable.
REQUEST_HEADER_FIELDS_TOO_LARGE  = 431
431 Request Header Fields Too Large.
REQUEST_TIMEOUT  = 408
408 Request Timeout.
RESET_CONTENT  = 205
205 Reset Content.
SEE_OTHER  = 303
303 See Other.
SERVICE_UNAVAILABLE  = 503
503 Service Unavailable.
SWITCH_PROXY  = 306
306 unused.
SWITCHING_PROTOCOLS  = 101
101 Switching Protocols.
TEMPORARY_REDIRECT  = 307
307 Temporary Redirect.
TOO_EARLY  = 425
425 Too Early.
TOO_MANY_REQUESTS  = 429
429 Too Many Requests.
UNAUTHORIZED  = 401
401 Unauthorized.
UNAVAILABLE_FOR_LEGAL_REASONS  = 451
451 Unavailable For Legal Reasons.
UNPROCESSABLE_ENTITY  = 422
422 Unprocessable Entity (WebDAV).
UNSUPPORTED_MEDIA_TYPE  = 415
415 Unsupported Media Type.
UPGRADE_REQUIRED  = 426
426 Upgrade Required.
URI_TOO_LARGE  = 414
414 URI Too Long.
USE_PROXY  = 305
305 Use Proxy.
VARIANT_ALSO_NEGOTIATES  = 506
506 Variant Also Negotiates.
$status  : array<string|int, mixed>
Response status codes and reasons.
getReason()  : string
setStatus()  : void
validate()  : int

Constants

ACCEPTED

202 Accepted.

public int ACCEPTED = 202

The request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is intended for cases where another process or server handles the request, or for batch processing.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202

CLIENT_CLOSED_REQUEST

499 Client Closed Request (nginx).

public int CLIENT_CLOSED_REQUEST = 499

A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request.

Tags
see
https://httpstatuses.com/499

GONE

410 Gone.

public int GONE = 410

This response is sent when the requested content has been permanently deleted from server, with no forwarding address. Clients are expected to remove their caches and links to the resource. The HTTP specification intends this status code to be used for "limited-time, promotional services". APIs should not feel compelled to indicate resources that have been deleted with this status code.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410

MISDIRECTED_REQUEST

421 Misdirected Request.

public int MISDIRECTED_REQUEST = 421

The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/421

MULTIPLE_CHOICES

300 Multiple Choices.

public int MULTIPLE_CHOICES = 300

The request has more than one possible response. The user-agent or user should choose one of them. (There is no standardized way of choosing one of the responses, but HTML links to the possibilities are recommended so the user can pick.)

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/300

NETWORK_CONNECT_TIMEOUT_ERROR

599 Network Connect Timeout Error.

public int NETWORK_CONNECT_TIMEOUT_ERROR = 599

This status code is not specified in any RFCs, but is used by some HTTP proxies to signal a network connect timeout behind the proxy to a client in front of the proxy.

Tags
see
https://httpstatuses.com/599

NON_AUTHORITATIVE_INFORMATION

203 Non-Authoritative Information.

public int NON_AUTHORITATIVE_INFORMATION = 203

This response code means the returned meta-information is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. This is mostly used for mirrors or backups of another resource. Except for that specific case, the "200 OK" response is preferred to this status.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/203

NOT_FOUND

404 Not Found.

public int NOT_FOUND = 404

The server can not find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurrence on the web.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

NOT_IMPLEMENTED

501 Not Implemented.

public int NOT_IMPLEMENTED = 501

The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/501

OK

200 OK.

public int OK = 200

The request has succeeded. The meaning of the success depends on the HTTP method:

  • GET: The resource has been fetched and is transmitted in the message body.

  • HEAD: The representation headers are included in the response without any message body.

  • PUT or POST: The resource describing the result of the action is transmitted in the message body.

  • TRACE: The message body contains the request message as received by the server.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200

PAYMENT_REQUIRED

402 Payment Required.

public int PAYMENT_REQUIRED = 402

This response code is reserved for future use. The initial aim for creating this code was using it for digital payment systems, however this status code is used very rarely and no standard convention exists.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402

PERMANENT_REDIRECT

308 Permanent Redirect.

public int PERMANENT_REDIRECT = 308

This means that the resource is now permanently located at another URI, specified by the Location: HTTP Response header. This has the same semantics as the 301 Moved Permanently HTTP response code, with the exception that the user agent must not change the HTTP method used: If a POST was used in the first request, a POST must be used in the second request.

Tags
see
ResponseHeader::LOCATION
see
Status::MOVED_PERMANENTLY
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308

PRECONDITION_REQUIRED

428 Precondition Required.

public int PRECONDITION_REQUIRED = 428

The origin server requires the request to be conditional. This response is intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/428

REQUEST_HEADER_FIELDS_TOO_LARGE

431 Request Header Fields Too Large.

public int REQUEST_HEADER_FIELDS_TOO_LARGE = 431

The server is unwilling to process the request because its header fields are too large. The request may be resubmitted after reducing the size of the request header fields.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/431

REQUEST_TIMEOUT

408 Request Timeout.

public int REQUEST_TIMEOUT = 408

This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408

SERVICE_UNAVAILABLE

503 Service Unavailable.

public int SERVICE_UNAVAILABLE = 503

The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This response should be used for temporary conditions and the Retry-After: HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.

Tags
see
ResponseHeader::RETRY_AFTER
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503

TEMPORARY_REDIRECT

307 Temporary Redirect.

public int TEMPORARY_REDIRECT = 307

The server sends this response to direct the client to get the requested resource at another URI with same method that was used in the prior request. This has the same semantics as the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP method used: If a POST was used in the first request, a POST must be used in the second request.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307

USE_PROXY

305 Use Proxy.

public int USE_PROXY = 305

Defined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. It has been deprecated due to security concerns regarding in-band configuration of a proxy.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/305

VARIANT_ALSO_NEGOTIATES

506 Variant Also Negotiates.

public int VARIANT_ALSO_NEGOTIATES = 506

The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.

Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/506

Properties

$status

Response status codes and reasons.

protected static array<string|int, mixed> $status = [ // --------------------------------------------------------------------- // Informational responses // --------------------------------------------------------------------- 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 103 => 'Early Hints', // --------------------------------------------------------------------- // Successful responses // --------------------------------------------------------------------- 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', 208 => 'Already Reported', 226 => 'IM Used', // --------------------------------------------------------------------- // Redirection messages // --------------------------------------------------------------------- 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', // --------------------------------------------------------------------- // Client error responses // --------------------------------------------------------------------- 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Payload Too Large', 414 => 'URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Range Not Satisfiable', 417 => 'Expectation Failed', 418 => "I'm a teapot", 421 => 'Misdirected Request', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Too Early', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 499 => 'Client Closed Request', // --------------------------------------------------------------------- // Server error responses // --------------------------------------------------------------------- 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required', 599 => 'Network Connect Timeout Error', ]
Tags
see
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Methods

getReason()

public static getReason(int $code[, string|null $default = null ]) : string
Parameters
$code : int
$default : string|null = null
Tags
throws
InvalidArgumentException

for invalid code

throws
LogicException

for unknown code without a default reason

Return values
string

setStatus()

public static setStatus(int $code, string $reason) : void
Parameters
$code : int
$reason : string
Return values
void

validate()

public static validate(int $code) : int
Parameters
$code : int
Return values
int

Search results