PHP Classes


Recommend this page to a friend!
  Classes of Pierre-Henry Soria   Just Http Status Codes   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Just Http Status Codes
Constants for the most common HTTP status codes
Author: By
Last change:
Date: 1 year ago
Size: 2,680 bytes


Class file image Download

Just HTTP Status Codes

Just HTTP Status Codes is a great way to empower your project with clean practice ?

? Overview

Ko Fi - Offer Me A Coffee

Simplest. Clean. Efficient. Just what your project needs ?

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 HTTP Status Codes constants

? PHP Requirement

PHP v7.3 or newer ?

? Installation

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';

? 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


? Who cooked it?

Pierre-Henry Soria

[![@phenrysay][twitter-image]]( [![pH-7][github-image]](

Pierre-Henry Soria, a highly passionate, zen & pragmatic software engineer ?

??? Are you enjoying it? Offer me a coffee and boost the software development at the same time! ?

? Me building it

[![Watch the video][video-thumbnail]](

? Click here to watch on YouTube

?? License

Just HTTP StatusCodes is generously distributed under the _MIT_ ? Enjoy!

<!-- GitHub's Markdown reference links --> [twitter-image]: [github-image]: [video-thumbnail]: