yaroslawww / http-statuscodes
PHP library for handling HTTP status codes
0.1.0
2022-04-01 11:24 UTC
Requires
- php: ^7.2|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- mockery/mockery: ^1.3
- php-mock/php-mock: ^2.1
- php-mock/php-mock-phpunit: ^2.5
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.20
This package is auto-updated.
Last update: 2024-11-29 05:51:17 UTC
README
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.