PHP code example of frankdejonge / http-status-in-range

1. Go to this page and download the library: Download frankdejonge/http-status-in-range 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/ */

    

frankdejonge / http-status-in-range example snippets




use function FrankDeJonge\HttpStatusRange\http_status_in_range;
use function FrankDeJonge\HttpStatusRange\http_status_not_in_range;
use const FrankDeJonge\HttpStatusRange\HTTP_SUCCESS;

$response = $httpClient->get('/something');

if (http_status_in_range($response->getStatusCode(), HTTP_SUCCESS)) {
    // SUCCESS!
}

if (http_status_not_in_range($response->getStatusCode(), HTTP_SUCCESS)) {
    // NOT SUCCESS!
}