codeinc / http-reason-phrase-lookup
A class to lookup HTTP reason phrases
Installs: 36 719
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
pkg:composer/codeinc/http-reason-phrase-lookup
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2025-09-25 09:51:34 UTC
README
This library is a PHP 7.1 library dedicated to lookup HTTP reason phrases. It is using the reason phrases list from the Guzzle PSR-7 package.
Usage
<?php use CodeInc\Psr7ResponseSender\HttpReasonPhraseLookup; // you can lookup a given status code HttpReasonPhraseLookup::getReasonPhrase(404); // returns 'Not Found' HttpReasonPhraseLookup::getReasonPhrase(999); // returns null // or list all the reason phrases foreach (HttpReasonPhraseLookup::getReasonPhrases() as $statusCode => $reasonPhrase) { echo "$statusCode => $reasonPhrase\n"; }
Installation
This library is available through Packagist and can be installed using Composer:
composer require codeinc/http-reason-phrase-lookup
License
This library is published under the MIT license (see the LICENSE
file).