PHP Classes


Recommend this page to a friend!
  Classes of Josantonius  >  PHP HTTP Status Code  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP HTTP Status Code
Get descriptions of HTTP response status codes
Author: By
Last change: Updated to 1.1.3 version
Updated to 1.1.3 version
Date: 14 days ago
Size: 6,355 bytes


Class file image Download

PHP HTTPStatusCode library

Latest Stable Version Total Downloads Latest Unstable Version License Travis

Versión en español

PHP library to get the meaning from HTTP response status codes.


The preferred way to install this extension is through composer.

To install PHP HTTPStatusCode library, simply:

$ composer require Josantonius/HTTPStatusCode

The previous command will only install the necessary files, if you prefer to download the entire source code (including tests, vendor folder, exceptions not used, docs...) you can use:

$ composer require Josantonius/HTTPStatusCode --prefer-source

Or you can also clone the complete repository with Git:

$ git clone


This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.

Quick Start and Examples

To use this class, simply:

require __DIR__ . '/vendor/autoload.php';

use Josantonius\HTTPStatusCode\HTTPStatusCode;

Available Methods

Available methods in this library:



Example of use for this library:

require __DIR__ . '/vendor/autoload.php';

use Josantonius\HTTPStatusCode\HTTPStatusCode;

### Get short meaning

echo "<br>[200] · " . HTTPStatusCode::get(100);
echo "<br>[200] · " . HTTPStatusCode::get(100, 'es');

[100] · Continue
[100] · Continuar

### Get detailed meaning

echo "<br>[100] · " . HTTPStatusCode::get(100, 'es', 'large');
echo "<br>[100] · " . HTTPStatusCode::get(100, 'en', 'large');

[100] · El navegador puede continuar realizando su petición (se utiliza para indicar que la primera parte de la petición del navegador se ha recibido correctamente).
[100] · The server has received the request headers and the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient. To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.

### Get all in english

$HTTPStatusCodes = HTTPStatusCode::getAll();

echo '<pre>'; var_dump($HTTPStatusCodes); echo '</pre>';

array(67) {
  array(2) {
    string(13) "Informational"
    string(339) "Request received, continuing process. This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes, servers must not send a 1xx response to an HTTP/1.0 client except under experimental conditions."

### Get all in spanish

$HTTPStatusCodes = HTTPStatusCode::getAll('es');

echo '<pre>'; var_dump($HTTPStatusCodes); echo '</pre>';

array(67) {
  array(2) {
    string(23) "Respuestas informativas"
    string(875) "Petición recibida, continuando proceso. Esta respuesta significa que el servidor ha recibido los encabezados de la petición, y que el cliente debería proceder a enviar el cuerpo de la misma (en el caso de peticiones para las cuales el cuerpo necesita ser enviado; por ejemplo, una petición Hypertext Transfer Protocol). Si el cuerpo de la petición es largo, es ineficiente enviarlo a un servidor, cuando la petición ha sido ya rechazada, debido a encabezados inapropiados. Para hacer que un servidor cheque si la petición podría ser aceptada basada únicamente en los encabezados de la petición, el cliente debe enviar Expect: 100-continue como un encabezado en su petición inicial (vea Plantilla:Web-RFC: Expect header) y verificar si un código de estado 100 Continue es recibido en respuesta, antes de continuar (o recibir 417 Expectation Failed y no continuar)."


To run tests simply:

$ git clone

$ cd PHP-HTTPStatusCode

$ phpunit


  • [x] Create tests
  • [ ] Improve documentation


  1. Check for open issues or open a new issue to start a discussion around a bug or feature.
  2. Fork the repository on GitHub to start making your changes.
  3. Write one or more tests for the new feature or that expose the bug.
  4. Make code changes to implement the feature or fix the bug.
  5. Send a pull request to get your changes merged and published.

This is intended for large and long-lived objects.


All files in this repository were created and uploaded automatically with Reposgit Creator.


This project is licensed under MIT license. See the LICENSE file for more info.


2016 -2017 Josantonius,

If you find it useful, let me know :wink:

You can contact me on Twitter or through my email.