initial commit
This commit is contained in:
		
							
								
								
									
										73
									
								
								helpers/constants/http_status_codes.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								helpers/constants/http_status_codes.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,73 @@ | ||||
| <?php | ||||
| 
 | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
| | HTTP Status Codes | ||||
| |-------------------------------------------------------------------------- | ||||
| | | ||||
| | Here is a collection of HTTP status codes and a corresponding string | ||||
| | that is human-friendly and easy to remember. | ||||
| | | ||||
| */ | ||||
| 
 | ||||
| $httpCodes = [ | ||||
|     // 100's (informational / "hold on")
 | ||||
|     100 => 'HTTP_CONTINUE', | ||||
|     101 => 'HTTP_SWITCHING_PROTOCOLS', | ||||
|     102 => 'HTTP_PROCESSING', | ||||
|     103 => 'HTTP_EARLY_HINTS', | ||||
| 
 | ||||
|     // 200's (successful / "here you go")
 | ||||
|     200 => 'HTTP_SUCCESS', | ||||
|     201 => 'HTTP_CREATED', | ||||
|     202 => 'HTTP_ACCEPTED', | ||||
|     204 => 'HTTP_NO_CONTENT', | ||||
|     205 => 'HTTP_RESET_CONTENT', | ||||
|     206 => 'HTTP_PARTIAL_CONTENT', | ||||
| 
 | ||||
|     // 300's (redirections / "go away")
 | ||||
|     300 => 'HTTP_MULTIPLE_CHOICE', | ||||
|     301 => 'HTTP_MOVED_PERMANENTLY', | ||||
|     302 => 'HTTP_REDIRECT_FOUND', | ||||
|     303 => 'HTTP_SEE_OTHER', | ||||
|     304 => 'HTTP_NOT_MODIFIED', | ||||
|     307 => 'HTTP_TEMPORARY_REDIRECT', | ||||
|     308 => 'HTTP_PERMANENT_REDIRECT', | ||||
| 
 | ||||
|     // 400's (app got the request but couldn't process it successfully, coding error / "user screwed up")
 | ||||
|     400 => 'HTTP_BAD_REQUEST', | ||||
|     401 => 'HTTP_UNAUTHORIZED', | ||||
|     402 => 'HTTP_PAYMENT_REQUIRED', | ||||
|     403 => 'HTTP_FORBIDDEN', | ||||
|     404 => 'HTTP_NOT_FOUND', | ||||
|     405 => 'HTTP_METHOD_NOT_ALLOWED', | ||||
|     406 => 'HTTP_NOT_ACCEPTABLE', | ||||
|     408 => 'HTTP_TIMEOUT', | ||||
|     409 => 'HTTP_CONFLICT', | ||||
|     410 => 'HTTP_GONE', | ||||
|     412 => 'HTTP_PRECONDITION_FAILED', | ||||
|     413 => 'HTTP_PAYLOAD_TOO_LARGE', | ||||
|     415 => 'HTTP_UNSUPPORTED_MEDIA', | ||||
|     413 => 'HTTP_TOO_LARGE', | ||||
|     417 => 'HTTP_EXPECTATION_FAIL', | ||||
|     418 => 'HTTP_TEAPOT', | ||||
|     422 => 'HTTP_UNPROCESSABLE_ENTITY', | ||||
|     423 => 'HTTP_LOCKED', | ||||
|     424 => 'HTTP_FAILED_DEPENDENCY', | ||||
|     236 => 'HTTP_UPGRADE_REQUIRED', | ||||
|     428 => 'HTTP_PRECONDITION_REQUIRED', | ||||
|     429 => 'HTTP_TOO_MANY_REQUESTS', | ||||
|     451 => 'HTTP_GAG_ORDER', | ||||
| 
 | ||||
|     // 500's (server-level problem, process died or configuration is incorrect / "server screwed up")
 | ||||
|     500 => 'HTTP_SERVER_ERROR', | ||||
|     501 => 'HTTP_NOT_IMPLEMENTED', | ||||
|     503 => 'HTTP_UNAVAILABLE', | ||||
|     530 => 'HTTP_SUSPENDED', | ||||
| ]; | ||||
| 
 | ||||
| foreach ($httpCodes as $code => $slug) { | ||||
|     if (! defined($slug)) { | ||||
|         define($slug, $code); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user