-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpStatusCodes.php
More file actions
441 lines (374 loc) · 10.1 KB
/
HttpStatusCodes.php
File metadata and controls
441 lines (374 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<?php
namespace archerbyte;
/**
* Class HttpStatusCodes
*
* This class defines constants for all standard HTTP status codes. These codes indicate
* the result of an HTTP request, from successful responses to client and server errors.
*
* @package PHP-Api
* @author archerbyte
* @link https://archerbyte.dev
* @license MIT
*/
class HttpStatusCodes {
// 1xx: Informational responses
/**
* 100 Continue
*
* The server has received the request headers, and the client should proceed to send the request body.
*/
const CONTINUE = 100;
/**
* 101 Switching Protocols
*
* The server is switching protocols as requested by the client.
*/
const SWITCHING_PROTOCOLS = 101;
/**
* 102 Processing (WebDAV)
*
* The server has received and is processing the request, but no response is available yet.
*/
const PROCESSING = 102;
// 2xx: Success
/**
* 200 OK
*
* The request was successful and the server has returned the requested data.
*/
const OK = 200;
/**
* 201 Created
*
* The request was successful and the server has created a new resource as a result.
*/
const CREATED = 201;
/**
* 202 Accepted
*
* The request has been accepted for processing, but the processing has not been completed.
*/
const ACCEPTED = 202;
/**
* 203 Non-Authoritative Information
*
* The request was successful but the returned metadata may be from a cached copy.
*/
const NON_AUTHORITATIVE_INFORMATION = 203;
/**
* 204 No Content
*
* The request was successful but the server has no data to return.
*/
const NO_CONTENT = 204;
/**
* 205 Reset Content
*
* The server successfully processed the request, but is not returning any content.
*/
const RESET_CONTENT = 205;
/**
* 206 Partial Content
*
* The server is returning a portion of the requested resource due to a range header sent by the client.
*/
const PARTIAL_CONTENT = 206;
// 3xx: Redirection
/**
* 300 Multiple Choices
*
* There are multiple options for the resource from which the client may choose.
*/
const MULTIPLE_CHOICES = 300;
/**
* 301 Moved Permanently
*
* The resource has permanently moved to a new location, and future requests should be directed there.
*/
const MOVED_PERMANENTLY = 301;
/**
* 302 Found (Previously "Moved Temporarily")
*
* The resource has temporarily moved to a new location.
*/
const FOUND = 302;
/**
* 303 See Other
*
* The response to the request can be found under a different URI using the GET method.
*/
const SEE_OTHER = 303;
/**
* 304 Not Modified
*
* The resource has not been modified since the last request.
*/
const NOT_MODIFIED = 304;
/**
* 305 Use Proxy
*
* The requested resource must be accessed through a proxy.
*/
const USE_PROXY = 305;
/**
* 307 Temporary Redirect
*
* The resource resides temporarily under a different URI, and future requests should use the same URI.
*/
const TEMPORARY_REDIRECT = 307;
/**
* 308 Permanent Redirect
*
* The resource has permanently moved to a new URI, and future requests should be directed there.
*/
const PERMANENT_REDIRECT = 308;
// 4xx: Client Errors
/**
* 400 Bad Request
*
* The server could not understand the request due to invalid syntax.
*/
const BAD_REQUEST = 400;
/**
* 401 Unauthorized
*
* The client must authenticate itself to get the requested response.
*/
const UNAUTHORIZED = 401;
/**
* 402 Payment Required
*
* Reserved for future use.
*/
const PAYMENT_REQUIRED = 402;
/**
* 403 Forbidden
*
* The server understands the request, but it refuses to authorize it.
*/
const FORBIDDEN = 403;
/**
* 404 Not Found
*
* The server cannot find the requested resource.
*/
const NOT_FOUND = 404;
/**
* 405 Method Not Allowed
*
* The HTTP method used is not allowed for the resource.
*/
const METHOD_NOT_ALLOWED = 405;
/**
* 406 Not Acceptable
*
* The server cannot generate a response that is acceptable according to the Accept headers sent in the request.
*/
const NOT_ACCEPTABLE = 406;
/**
* 407 Proxy Authentication Required
*
* The client must authenticate with a proxy before proceeding.
*/
const PROXY_AUTHENTICATION_REQUIRED = 407;
/**
* 408 Request Timeout
*
* The server timed out waiting for the request.
*/
const REQUEST_TIMEOUT = 408;
/**
* 409 Conflict
*
* The request could not be completed due to a conflict with the current state of the resource.
*/
const CONFLICT = 409;
/**
* 410 Gone
*
* The resource is no longer available and will not be available again.
*/
const GONE = 410;
/**
* 411 Length Required
*
* The server requires the Content-Length header to be set in the request.
*/
const LENGTH_REQUIRED = 411;
/**
* 412 Precondition Failed
*
* One or more conditions in the request headers were not met.
*/
const PRECONDITION_FAILED = 412;
/**
* 413 Payload Too Large
*
* The request is larger than the server is willing or able to process.
*/
const PAYLOAD_TOO_LARGE = 413;
/**
* 414 URI Too Long
*
* The URI provided was too long for the server to process.
*/
const URI_TOO_LONG = 414;
/**
* 415 Unsupported Media Type
*
* The server refuses to accept the request because the media type is not supported.
*/
const UNSUPPORTED_MEDIA_TYPE = 415;
/**
* 416 Range Not Satisfiable
*
* The range specified in the request's Range header is invalid.
*/
const RANGE_NOT_SATISFIABLE = 416;
/**
* 417 Expectation Failed
*
* The server cannot meet the requirements of the Expect header.
*/
const EXPECTATION_FAILED = 417;
/**
* 418 I'm a teapot (April Fools' Joke)
*
* The teapot refuses to brew coffee because it is a teapot.
*/
const IM_A_TEAPOT = 418;
/**
* 421 Misdirected Request
*
* The request was directed at a server that is not able to produce a response.
*/
const MISDIRECTED_REQUEST = 421;
/**
* 422 Unprocessable Entity (WebDAV)
*
* The server understands the request but cannot process it due to semantic errors.
*/
const UNPROCESSABLE_ENTITY = 422;
/**
* 423 Locked (WebDAV)
*
* The resource that is being accessed is locked.
*/
const LOCKED = 423;
/**
* 424 Failed Dependency (WebDAV)
*
* The request failed due to failure of a previous request.
*/
const FAILED_DEPENDENCY = 424;
/**
* 425 Too Early
*
* The server is unwilling to risk processing a request that might be replayed.
*/
const TOO_EARLY = 425;
/**
* 426 Upgrade Required
*
* The client should upgrade to a different protocol, such as TLS.
*/
const UPGRADE_REQUIRED = 426;
/**
* 427 Unassigned
*
* Reserved for future use.
*/
const UNASSIGNED = 427;
/**
* 428 Precondition Required
*
* The server requires the request to be conditional.
*/
const PRECONDITION_REQUIRED = 428;
/**
* 429 Too Many Requests
*
* The user has sent too many requests in a given amount of time.
*/
const TOO_MANY_REQUESTS = 429;
/**
* 431 Request Header Fields Too Large
*
* The server is unwilling to process the request because the header fields are too large.
*/
const REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
/**
* 451 Unavailable For Legal Reasons
*
* The resource is unavailable due to legal reasons.
*/
const UNAVAILABLE_FOR_LEGAL_REASONS = 451;
// 5xx: Server Errors
/**
* 500 Internal Server Error
*
* The server encountered an unexpected condition that prevented it from fulfilling the request.
*/
const INTERNAL_SERVER_ERROR = 500;
/**
* 501 Not Implemented
*
* The server does not support the functionality required to fulfill the request.
*/
const NOT_IMPLEMENTED = 501;
/**
* 502 Bad Gateway
*
* The server, while acting as a gateway or proxy, received an invalid response from the upstream server.
*/
const BAD_GATEWAY = 502;
/**
* 503 Service Unavailable
*
* The server is not ready to handle the request, usually due to being overloaded or down for maintenance.
*/
const SERVICE_UNAVAILABLE = 503;
/**
* 504 Gateway Timeout
*
* The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
*/
const GATEWAY_TIMEOUT = 504;
/**
* 505 HTTP Version Not Supported
*
* The server does not support the HTTP protocol version that was used in the request.
*/
const HTTP_VERSION_NOT_SUPPORTED = 505;
/**
* 506 Variant Also Negotiates
*
* The server has an internal configuration error and cannot complete the negotiation.
*/
const VARIANT_ALSO_NEGOTIATES = 506;
/**
* 507 Insufficient Storage (WebDAV)
*
* The server is unable to store the representation needed to complete the request.
*/
const INSUFFICIENT_STORAGE = 507;
/**
* 508 Loop Detected (WebDAV)
*
* The server detected an infinite loop while processing the request.
*/
const LOOP_DETECTED = 508;
/**
* 510 Not Extended
*
* Further extensions to the request are required for the server to fulfill it.
*/
const NOT_EXTENDED = 510;
/**
* 511 Network Authentication Required
*
* The client needs to authenticate to gain network access.
*/
const NETWORK_AUTHENTICATION_REQUIRED = 511;
}