Status
in package
Class Status.
Tags
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
ALREADY_REPORTED
208 Already Reported (WebDAV).
public
int
ALREADY_REPORTED
= 208
Used inside a <dav:propstat>
response element to avoid repeatedly
enumerating the internal members of multiple bindings to the same
collection.
Tags
BAD_GATEWAY
502 Bad Gateway.
public
int
BAD_GATEWAY
= 502
This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.
Tags
BAD_REQUEST
400 Bad Request.
public
int
BAD_REQUEST
= 400
The server could not understand the request due to invalid syntax.
Tags
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
CONFLICT
409 Conflict.
public
int
CONFLICT
= 409
This response is sent when a request conflicts with the current state of the server.
Tags
CONTINUE
100 Continue.
public
int
CONTINUE
= 100
This interim response indicates that everything so far is OK and that the client should continue the request, or ignore the response if the request is already finished.
Tags
CREATED
201 Created.
public
int
CREATED
= 201
The request has succeeded and a new resource has been created as a result. This is typically the response sent after POST requests, or some PUT requests.
Tags
EARLY_HINTS
103 Early Hints.
public
int
EARLY_HINTS
= 103
This status code is primarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response.
Tags
EXPECTATION_FAILED
417 Expectation Failed.
public
int
EXPECTATION_FAILED
= 417
This response code means the expectation indicated by the Expect
request header field can't be met by the server.
Tags
FAILED_DEPENDENCY
424 Failed Dependency (WebDAV).
public
int
FAILED_DEPENDENCY
= 424
The request failed due to failure of a previous request.
Tags
FORBIDDEN
403 Forbidden.
public
int
FORBIDDEN
= 403
The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.
Tags
FOUND
302 Found.
public
int
FOUND
= 302
This response code means that the URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.
Tags
GATEWAY_TIMEOUT
504 Gateway Timeout.
public
int
GATEWAY_TIMEOUT
= 504
This error response is given when the server is acting as a gateway and cannot get a response in time.
Tags
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
HTTP_VERSION_NOT_SUPPORTED
505 HTTP Version Not Supported.
public
int
HTTP_VERSION_NOT_SUPPORTED
= 505
The HTTP version used in the request is not supported by the server.
Tags
IM_A_TEAPOT
418 I'm a teapot.
public
int
IM_A_TEAPOT
= 418
The server refuses the attempt to brew coffee with a teapot.
Tags
IM_USED
226 IM Used (HTTP Delta encoding).
public
int
IM_USED
= 226
The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
Tags
INSUFFICIENT_STORAGE
507 Insufficient Storage (WebDAV).
public
int
INSUFFICIENT_STORAGE
= 507
The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.
Tags
INTERNAL_SERVER_ERROR
500 Internal Server Error.
public
int
INTERNAL_SERVER_ERROR
= 500
The server has encountered a situation it doesn't know how to handle.
Tags
LENGTH_REQUIRED
411 Length Required.
public
int
LENGTH_REQUIRED
= 411
Server rejected the request because the Content-Length header field is not defined and the server requires it.
Tags
LOCKED
423 Locked (WebDAV).
public
int
LOCKED
= 423
The resource that is being accessed is locked.
Tags
LOOP_DETECTED
508 Loop Detected (WebDAV).
public
int
LOOP_DETECTED
= 508
The server detected an infinite loop while processing the request.
Tags
METHOD_NOT_ALLOWED
405 Method Not Allowed.
public
int
METHOD_NOT_ALLOWED
= 405
The request method is known by the server but is not supported by the target resource. For example, an API may forbid DELETE-ing a resource.
Tags
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
MOVED_PERMANENTLY
301 Moved Permanently.
public
int
MOVED_PERMANENTLY
= 301
The URL of the requested resource has been changed permanently. The new URL is given in the response.
Tags
MULTI_STATUS
207 Multi-Status (WebDAV).
public
int
MULTI_STATUS
= 207
Conveys information about multiple resources, for situations where multiple status codes might be appropriate.
Tags
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
NETWORK_AUTHENTICATION_REQUIRED
511 Network Authentication Required.
public
int
NETWORK_AUTHENTICATION_REQUIRED
= 511
The 511 status code indicates that the client needs to authenticate to gain network access.
Tags
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
NO_CONTENT
204 No Content.
public
int
NO_CONTENT
= 204
There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.
Tags
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
NOT_ACCEPTABLE
406 Not Acceptable.
public
int
NOT_ACCEPTABLE
= 406
This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent.
Tags
NOT_EXTENDED
510 Not Extended.
public
int
NOT_EXTENDED
= 510
Further extensions to the request are required for the server to fulfill it.
Tags
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
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
NOT_MODIFIED
304 Not Modified.
public
int
NOT_MODIFIED
= 304
This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response.
Tags
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
PARTIAL_CONTENT
206 Partial Content.
public
int
PARTIAL_CONTENT
= 206
This response code is used when the Range header is sent from the client to request only part of a resource.
Tags
PAYLOAD_TOO_LARGE
413 Payload Too Large.
public
int
PAYLOAD_TOO_LARGE
= 413
Request entity is larger than limits defined by server; the server might
close the connection or return an Retry-After
header field.
Tags
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
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
PRECONDITION_FAILED
412 Precondition Failed.
public
int
PRECONDITION_FAILED
= 412
The client has indicated preconditions in its headers which the server does not meet.
Tags
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
PROCESSING
102 Processing (WebDAV).
public
int
PROCESSING
= 102
This code indicates that the server has received and is processing the request, but no response is available yet.
Tags
PROXY_AUTHENTICATION_REQUIRED
407 Proxy Authentication Required.
public
int
PROXY_AUTHENTICATION_REQUIRED
= 407
This is similar to 401 but authentication is needed to be done by a proxy.
Tags
RANGE_NOT_SATISFIABLE
416 Range Not Satisfiable.
public
int
RANGE_NOT_SATISFIABLE
= 416
The range specified by the Range
header field in the request can't be
fulfilled; it's possible that the range is outside the size of the target
URI's data.
Tags
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
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
RESET_CONTENT
205 Reset Content.
public
int
RESET_CONTENT
= 205
Tells the user-agent to reset the document which sent this request.
Tags
SEE_OTHER
303 See Other.
public
int
SEE_OTHER
= 303
The server sent this response to direct the client to get the requested resource at another URI with a GET request.
Tags
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
SWITCH_PROXY
306 unused.
public
int
SWITCH_PROXY
= 306
This response code is no longer used; it is just reserved. It was used in a previous version of the HTTP/1.1 specification.
Tags
SWITCHING_PROTOCOLS
101 Switching Protocols.
public
int
SWITCHING_PROTOCOLS
= 101
This code is sent in response to an Upgrade request header from the client, and indicates the protocol the server is switching to.
Tags
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
TOO_EARLY
425 Too Early.
public
int
TOO_EARLY
= 425
Indicates that the server is unwilling to risk processing a request that might be replayed.
Tags
TOO_MANY_REQUESTS
429 Too Many Requests.
public
int
TOO_MANY_REQUESTS
= 429
The user has sent too many requests in a given amount of time ("rate limiting").
Tags
UNAUTHORIZED
401 Unauthorized.
public
int
UNAUTHORIZED
= 401
Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.
Tags
UNAVAILABLE_FOR_LEGAL_REASONS
451 Unavailable For Legal Reasons.
public
int
UNAVAILABLE_FOR_LEGAL_REASONS
= 451
The user-agent requested a resource that cannot legally be provided, such as a web page censored by a government.
Tags
UNPROCESSABLE_ENTITY
422 Unprocessable Entity (WebDAV).
public
int
UNPROCESSABLE_ENTITY
= 422
The request was well-formed but was unable to be followed due to semantic errors.
Tags
UNSUPPORTED_MEDIA_TYPE
415 Unsupported Media Type.
public
int
UNSUPPORTED_MEDIA_TYPE
= 415
The media format of the requested data is not supported by the server, so the server is rejecting the request.
Tags
UPGRADE_REQUIRED
426 Upgrade Required.
public
int
UPGRADE_REQUIRED
= 426
The server refuses to perform the request using the current protocol but
might be willing to do so after the client upgrades to a different
protocol. The server sends an Upgrade
header in a 426 response to
indicate the required protocol(s).
Tags
URI_TOO_LARGE
414 URI Too Long.
public
int
URI_TOO_LARGE
= 414
The URI requested by the client is longer than the server is willing to interpret.
Tags
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
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
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
Methods
getReason()
public
static getReason(int $code[, string|null $default = null ]) : string
Parameters
- $code : int
- $default : string|null = null
Tags
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