- π Overview
- βοΈ PHP Requirement
- π€© Usage
- π§βπ³ About
- πΊ Watch How I've Built It
- βοΈ Who I Am
- βοΈ License
Simplest. Clean. Efficient. Just what your project needs π§Ή
Don't hardcode HTTP status codes. Magic numbers (hard-coded numbers) make your code hard to 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 from 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 v7.3 or newer π
composer require ph-7/just-http-status-codes
If you don't already use composer in your project, include Composer's autoload as below in the main index file, bootstrap or in another file that is always included in all pages.
require __DIR__ . '/vendor/autoload.php';
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
π Click here to watch on YouTube
Pierre-Henry Soria, a highly passionate, zen & pragmatic software engineer π
οΈβοΈ Are you enjoying it? Offer me a coffee (what's your favorite coffee? Mine is almond flat white π)
Just HTTP StatusCodes is generously distributed under the MIT π Enjoy!