HTTP Status Value Objects
Using The Predefined Value Objects
There's a predefined value object for each supported HTTP status code. The full list of objects is here: HTTP Status Value Classes.
You can create new instances of each HTTP status value object, and then use these however you want:
// import the class(es) you need
use GanbaroDigital\HttpStatus\StatusValues\Informational\ContinueStatus;
use GanbaroDigital\HttpStatus\Interfaces\HttpInformationalStatus;
// create the value object
$httpStatus = new ContinueStatus;
// making comparisons
//
// echos '1'
echo $httpStatus instanceof ContinueStatus . PHP_EOL;
echo $httpStatus instanceof HttpInformationalStatus . PHP_EOL;
HTTP Status Interfaces
Each predefined value object implements the HttpStatus
interface.
They also implement one of the following interfaces, so that you can easily tell what type of HTTP status it is: