ahmard / http-status-codes
Http Status Code Enums
Installs: 1 010
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
This package is not auto-updated.
Last update: 2025-04-04 07:56:25 UTC
README
Enums of all official http status codes and their descriptions.
Installation
composer require ahmard/http-status-codes
Usage
<?php require __DIR__ . '/vendor/autoload.php'; $sc = \HttpStatusCodes\StatusCode::CREATED; // Get Status Code => "201" $sc->value; $desc = $sc->describe(); // Get Status Code => "201" $desc->code; // Get Status Code Title => "Created" $desc->title;
You can also get description of a given status code, the description is copied from Wikipedia.
<?php $sc = \HttpStatusCodes\StatusCode::CREATED; // Get Description => "The request has been fulfilled, resulting in the creation of a new resource." $sc->describe()->desc;
- All titles & descriptions bundles in this package are collected from Wikipedia - List of HTTP status codes.