Just HTTP StatusCodes
π«
Just HTTP Status Codes is a great way to empower your project with clean practice
π
Description
Don't hardcode HTTP status codes. Magic numbers (hard-coded numbers) make your code hard to be read and understood.
When you have all status codes are stored in readable constants, it makes the development of your application so easy and enjoyable.
It prevents you of using the wrong HTTP status code and saves time and energy when developing an API that involves various HTTP status codes to be sent.
π
PHP Requirement
[PHP v7.1](https://www.php.net/releases/7_1_0.php) or newer.
π
Installation
composer require ph-7/just-http-status-codes
Then, if you don't already use composer in your project, include Composer's autoload as below in the index, bootstrap or another file that are included everywhere when you project is running
require __DIR__ . '/vendor/autoload.php';
π₯³
Usage
Just use the beautiful HTTP status code you need.
Like below
use PH7\JustHttp\StatusCode;
StatusCode::OK; // This is 200
StatusCode::CREATED; // 201 code
StatusCode::NOT_FOUND; // 404
StatusCode::INTERNAL_SERVER_ERROR; // 500
π
Who cooked it?
Pierre-Henry Soria, a highly passionate, zen & pragmatic software engineer
βοΈ
License
Just HTTP StatusCodes is generously distributed under the MIT.