kayex/http-codes

Small PHP library for easily accessing HTTP Status Codes.

1.1.1 2018-01-12 12:21 UTC

This package is not auto-updated.

Last update: 2024-12-21 21:42:13 UTC


README

Latest Stable Version Total Downloads License

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