PHPackages                             narrowspark/http-status - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. narrowspark/http-status

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

narrowspark/http-status
=======================

A psr-7 package for working with HTTP statuses.

4.1.0(7y ago)945.8k↓66.7%5[3 PRs](https://github.com/narrowspark/http-status/pulls)1MITPHPPHP ^7.2

Since Jun 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/narrowspark/http-status)[ Packagist](https://packagist.org/packages/narrowspark/http-status)[ Docs](https://github.com/narrowspark/http-status)[ RSS](/packages/narrowspark-http-status/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (12)Used By (1)

Http Status
-----------

[](#http-status)

### A package for working with HTTP statuses.

[](#a-package-for-working-with-http-statuses)

 [![](https://camo.githubusercontent.com/842f9732045c673fc86ec054f9d02e5c66a207b73a23f7985daa272efbc49b1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6172726f77737061726b2f687474702d7374617475732e7376673f7374796c653d666c61742d737175617265)](https://github.com/narrowspark/http-status/releases) [![](https://camo.githubusercontent.com/e243dd412fc99473435d040a0afcf80ae870af909aa4a9bfc418e03224cf8115/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545372e322e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/) [![](https://camo.githubusercontent.com/c3da5d3c9860bf5df4bb5daf3efc79868ebd91be2a7452c03d372394bb307788/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e6172726f77737061726b2f687474702d7374617475732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/narrowspark/http-status) [![](https://camo.githubusercontent.com/e22396f55c20e337fa7d40cc8d495a31b9721ce66287b0f76fb94ecbab449f1f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6e6172726f77737061726b2f687474702d7374617475732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/narrowspark/http-status) [![](https://camo.githubusercontent.com/08f6a1293a8aaa0c83783cf0107b27d553e93d1f760949499225d3ffbeb4570f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6172726f77737061726b2f687474702d7374617475732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/narrowspark/http-status) [![](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](http://opensource.org/licenses/MIT)

Installation
------------

[](#installation)

Via Composer

```
$ composer require narrowspark/http-status
```

Use
---

[](#use)

```
use Narrowspark\HttpStatus\Contract\Exception\HttpException as HttpExceptionContract;
use Narrowspark\HttpStatus\HttpStatus;

// get status message from code
echo HttpStatus::getReasonMessage(301); // This and all future requests should be directed to the given URI.

try {
    HttpStatus::getReasonException(301):
} catch(HttpExceptionContract $e) {
    echo $e->getMessage(); // 301 Moved Permanently
    echo $e->getStatusCode(); // 301
}
```

### Now we have support for ([http-message-util](//github.com/php-fig/http-message-util)) so you can do something like this:

[](#now-we-have-support-for-http-message-util-so-you-can-do-something-like-this)

```
use Narrowspark\HttpStatus\HttpStatus;

// get status name from code
echo HttpStatus::getReasonPhrase(HttpStatus::STATUS_MOVED_PERMANENTLY); // Moved Permanently
```

HTTP status code classes ([from RFC7231](//tools.ietf.org/html/rfc7231#section-6))
----------------------------------------------------------------------------------

[](#http-status-code-classes-from-rfc7231)

The first digit of the status-code defines the class of response. The last two digits do not have any categorization role. There are five values for the first digit:

DigitCategoryMeaning1xxInformationalThe request was received, continuing process2xxSuccessfulThe request was successfully received, understood, and accepted3xxRedirectionFurther action needs to be taken in order to complete the request4xxClient ErrorThe request contains bad syntax or cannot be fulfilled5xxServer ErrorThe server failed to fulfill an apparently valid requestAvailable HTTP status codes
---------------------------

[](#available-http-status-codes)

CodeMessageRFC100Continue\[RFC7231, Section 6.2.1\]101Switching Protocols\[RFC7231, Section 6.2.2\]102Processing\[RFC2518\]103Http Early Hints\[RFC8297\]104-199*Unassigned*200OK\[RFC7231, Section 6.3.1\]201Created\[RFC7231, Section 6.3.2\]202Accepted\[RFC7231, Section 6.3.3\]203Non-Authoritative Information\[RFC7231, Section 6.3.4\]204No Content\[RFC7231, Section 6.3.5\]205Reset Content\[RFC7231, Section 6.3.6\]206Partial Content\[RFC7233, Section 4.1\]207Multi-Status\[RFC4918\]208Already Reported\[RFC5842\]209-225*Unassigned*226IM Used\[RFC3229\]227-299*Unassigned*300Multiple Choices\[RFC7231, Section 6.4.1\]301Moved Permanently\[RFC7231, Section 6.4.2\]302Found\[RFC7231, Section 6.4.3\]303See Other\[RFC7231, Section 6.4.4\]304Not Modified\[RFC7232, Section 4.1\]305Use Proxy\[RFC7231, Section 6.4.5\]306(Unused)\[RFC7231, Section 6.4.6\]307Temporary Redirect\[RFC7231, Section 6.4.7\]308Permanent Redirect\[RFC7538\]309-399*Unassigned*400Bad Request\[RFC7231, Section 6.5.1\]401Unauthorized\[RFC7235, Section 3.1\]402Payment Required\[RFC7231, Section 6.5.2\]403Forbidden\[RFC7231, Section 6.5.3\]404Not Found\[RFC7231, Section 6.5.4\]405Method Not Allowed\[RFC7231, Section 6.5.5\]406Not Acceptable\[RFC7231, Section 6.5.6\]407Proxy Authentication Required\[RFC7235, Section 3.2\]408Request Timeout\[RFC7231, Section 6.5.7\]409Conflict\[RFC7231, Section 6.5.8\]410Gone\[RFC7231, Section 6.5.9\]411Length Required\[RFC7231, Section 6.5.10\]412Precondition Failed\[RFC7232, Section 4.2\]413Payload Too Large\[RFC7231, Section 6.5.11\]414URI Too Long\[RFC7231, Section 6.5.12\]415Unsupported Media Type\[RFC7231, Section 6.5.13\]416Range Not Satisfiable\[RFC7233, Section 4.4\]417Expectation Failed\[RFC7231, Section 6.5.14\]418-420*Unassigned*421Misdirected Request\[RFC7540, Section 9.1.2\]422Unprocessable Entity\[RFC4918\]423Locked\[RFC4918\]424Failed Dependency\[RFC4918\]425Too Early\[RFC-ietf-httpbis-replay-04\]426Upgrade Required\[RFC7231, Section 6.5.15\]427*Unassigned*428Precondition Required\[RFC6585\]429Too Many Requests\[RFC6585\]430*Unassigned*431Request Header Fields Too Large\[RFC6585\]432-450*Unassigned*451Unavailable For Legal\[RFC7725\]452-499*Unassigned*500Internal Server Error\[RFC7231, Section 6.6.1\]501Not Implemented\[RFC7231, Section 6.6.2\]502Bad Gateway\[RFC7231, Section 6.6.3\]503Service Unavailable\[RFC7231, Section 6.6.4\]504Gateway Timeout\[RFC7231, Section 6.6.5\]505HTTP Version Not Supported\[RFC7231, Section 6.6.6\]506Variant Also Negotiates\[RFC2295\]507Insufficient Storage\[RFC4918\]508Loop Detected\[RFC5842\]509*Unassigned*510Not Extended\[RFC2774\]511Network Authentication Required\[RFC6585\]512-599*Unassigned*Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

If you would like to help take a look at the [list of issues](http://github.com/narrowspark/http-emitter/issues) and check our [Contributing](CONTRIBUTING.md) guild.

> **Note:** Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

License
-------

[](#license)

The Narrowspark http-emitter is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~98 days

Recently: every ~118 days

Total

9

Last Release

2839d ago

Major Versions

1.1.0 → 2.0.02016-06-22

2.0.0 → 3.0.02017-02-20

3.0.2 → 4.0.02017-09-16

PHP version history (4 changes)1.0.0PHP ^5.6 || ^7.0

3.0.0PHP ^7.0

4.0.0PHP ^7.1

4.1.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca62e19a98f43cce88fa6733762bebbe26f4e7ee0b3d8defdadfd0b7082f77a0?d=identicon)[dani33](/maintainers/dani33)

---

Top Contributors

[![prisis](https://avatars.githubusercontent.com/u/2716058?v=4)](https://github.com/prisis "prisis (53 commits)")

---

Tags

httphttp-status-codephp72psr-7httppsr-7psr7exceptionstatushttp statushttp-status exceptions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/narrowspark-http-status/health.svg)

```
[![Health](https://phpackages.com/badges/narrowspark-http-status/health.svg)](https://phpackages.com/packages/narrowspark-http-status)
```

###  Alternatives

[wellrested/wellrested

Simple PHP Library for RESTful APIs

4818.7k4](/packages/wellrested-wellrested)[middlewares/error-handler

Middleware to handle http errors

14104.2k13](/packages/middlewares-error-handler)[pdeans/http

PSR-7 cURL HTTP client with support for PSR-17 HTTP factories.

1466.2k3](/packages/pdeans-http)[northwoods/router

Fast router for PSR-15 request handlers

161.4k](/packages/northwoods-router)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
