PHP code example of mrcl / http-status-codes

1. Go to this page and download the library: Download mrcl/http-status-codes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mrcl / http-status-codes example snippets


use Mrcl\Utils\InternetStandards\HttpStatus;

HttpStatus::OK        // 200
HttpStatus::NOT_FOUND // 404

HttpStatus::MESSAGES[200]                   // 'OK'
HttpStatus::MESSAGES[HttpStatus::NOT_FOUND] // 'Not Found'

use Mrcl\Utils\InternetStandards\HttpStatusCodes\Informational;

Informational::CONTINUE // 100

use Mrcl\Utils\InternetStandards\HttpStatusCodes\Success;

Success::ACCEPTED // 202

use Mrcl\Utils\InternetStandards\HttpStatusCodes\Redirection;

Redirection::MOVED_PERMANENTLY // 301

use Mrcl\Utils\InternetStandards\HttpStatusCodes\ClientError;

ClientError::BAD_REQUEST // 400

use Mrcl\Utils\InternetStandards\HttpStatusCodes\ServerError;

ServerError::NETWORK_AUTHENTICATION_REQUIRED // 511