kayex / http-codes
Small PHP library for easily accessing HTTP Status Codes.
Installs: 147 494
Dependents: 4
Suggesters: 0
Security: 0
Stars: 10
Watchers: 2
Forks: 4
Open Issues: 2
Requires (Dev)
- phpunit/phpunit: ^6.2
This package is not auto-updated.
Last update: 2024-11-09 21:12:00 UTC
README
PHP library for easily accessing HTTP Status codes.
Table of Contents
Installation
Composer
composer require kayex/http-codes
Usage
The codes are accessible as public static
properties on the HttpCodes class
use Kayex\HttpCodes; echo HttpCodes::HTTP_OK; // 200
Optional: Laravel alias
Laravel users may want to set up an alias for quick access by adding the following to the alias array in app/config/app.php
:
'HttpCodes' => 'Kayex\HttpCodes',
The codes can then be used like this:
use HttpCodes; echo HttpCodes::HTTP_OK; // 200
Full reference
These are all the available status codes and the names they are accessible under.
1xx - Informational
2xx - Successful
3xx - Redirect
4xx - Client Error
5xx - Server Error
License
MIT