PHP code example of intenave / http-response-status-codes

1. Go to this page and download the library: Download intenave/http-response-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/ */

    

intenave / http-response-status-codes example snippets


$status = HttpResponseStatusCode::OK(); // Get the "OK" (200) status code

$isSuccess = $status->isSuccess(); // Check if it's a success code (in the 200-299 range)

if ($isSuccess) {
    // Handle a successful response.
} else {
    // Handle a non-successful response.
}

$codes = HttpResponseStatusCode::codes();

$names = HttpResponseStatusCode::names();

$options = HttpResponseStatusCode::options();