Skip to content

yaroslawww/http-statuscodes

Repository files navigation

Http status codes library

Software License Build Status StyleCI Quality Score Code Coverage PHP Version Packagist Version

Installation

You can install the package via composer:

    composer require yaroslawww/http-statuscodes

Simple example

    $manager = new \HttpStatusCodes\StatusCodeManager();
    $statusCode = $manager->makeStatusCode(201);
    if($statusCode) {
        $statusCode->getMessage();
        $statusCode->getCode();
        $statusCode->getDescription();
        $statusCode->getRFCNumber();
    }
    $manager = new \HttpStatusCodes\StatusCodeManager();
    $statusCode = $manager->makeStatusCode('HTTP_OK');
    if($statusCode) {
        $statusCode->getMessage();
        $statusCode->getCode();
        $statusCode->getDescription();
        $statusCode->getRFCNumber();
    }
    class CustomStatusCodes
    {
        /**
         * @rfc 1133
         * @description Test Description New Ok
         * @message OKAY!
         */
        const HTTP_OKAY = 3333;
    }
    $manager = new \HttpStatusCodes\StatusCodeManager();
    $statusCode = $manager->makeStatusCode(3333);
    if($statusCode) {
        $statusCode->getMessage();
        $statusCode->getCode();
        $statusCode->getDescription();
        $statusCode->getRFCNumber();
    }

Testing

    ./vendor/bin/phpunit
    # or
    composer test

Security

If you discover any security related issues, please email yaroslav.georgitsa@gmail.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

About

Simple PHP library for managing HTTP status codes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages