PHPackages                             nullform/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. nullform/http-status

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

nullform/http-status
====================

HTTP status codes as constants

v1.4.0(1y ago)33.2k↓30.8%11MITPHPPHP ^7.0||^8.0

Since Mar 18Pushed 1y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (9)Used By (1)

nullform/http-status
--------------------

[](#nullformhttp-status)

HTTP status codes as constants in one simple class.

[RFC 9110](https://www.rfc-editor.org/rfc/rfc9110), [RFC 6585](https://www.rfc-editor.org/rfc/rfc6585)

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

[](#installation)

```
composer require nullform/http-status

```

Usage
-----

[](#usage)

```
use Nullform\HttpStatus;

// some code...

if ($response->getStatusCode() == HttpStatus::OK) {
    // some code...
} else {
    $error = HttpStatus::getDescription($response->getStatusCode());
}
```

HttpStatus constants
--------------------

[](#httpstatus-constants)

- HttpStatus::CONTINUE
- HttpStatus::SWITCHING\_PROTOCOLS
- HttpStatus::OK
- HttpStatus::CREATED
- HttpStatus::ACCEPTED
- HttpStatus::NON\_AUTHORITATIVE\_INFORMATION
- HttpStatus::NO\_CONTENT
- HttpStatus::RESET\_CONTENT
- HttpStatus::PARTIAL\_CONTENT
- HttpStatus::MULTIPLE\_CHOICES
- HttpStatus::MOVED\_PERMANENTLY
- HttpStatus::FOUND
- HttpStatus::SEE\_OTHER
- HttpStatus::NOT\_MODIFIED
- HttpStatus::USE\_PROXY
- HttpStatus::TEMPORARY\_REDIRECT
- HttpStatus::PERMANENT\_REDIRECT
- HttpStatus::BAD\_REQUEST
- HttpStatus::UNAUTHORIZED
- HttpStatus::PAYMENT\_REQUIRED
- HttpStatus::FORBIDDEN
- HttpStatus::NOT\_FOUND
- HttpStatus::METHOD\_NOT\_ALLOWED
- HttpStatus::NOT\_ACCEPTABLE
- HttpStatus::PROXY\_AUTHENTICATION\_REQUIRED
- HttpStatus::REQUEST\_TIMEOUT
- HttpStatus::CONFLICT
- HttpStatus::GONE
- HttpStatus::LENGTH\_REQUIRED
- HttpStatus::PRECONDITION\_FAILED
- HttpStatus::CONTENT\_TOO\_LARGE
- HttpStatus::URI\_TOO\_LONG
- HttpStatus::UNSUPPORTED\_MEDIA\_TYPE
- HttpStatus::RANGE\_NOT\_SATISFIABLE
- HttpStatus::EXPECTATION\_FAILED
- HttpStatus::MISDIRECTED\_REQUEST
- HttpStatus::UNPROCESSABLE\_CONTENT
- HttpStatus::UPGRADE\_REQUIRED
- HttpStatus::PRECONDITION\_REQUIRED
- HttpStatus::TOO\_MANY\_REQUESTS
- HttpStatus::REQUEST\_HEADER\_FIELDS\_TOO\_LARGE
- HttpStatus::INTERNAL\_SERVER\_ERROR
- HttpStatus::NOT\_IMPLEMENTED
- HttpStatus::BAD\_GATEWAY
- HttpStatus::SERVICE\_UNAVAILABLE
- HttpStatus::GATEWAY\_TIMEOUT
- HttpStatus::HTTP\_VERSION\_NOT\_SUPPORTED
- HttpStatus::NETWORK\_AUTHENTICATION\_REQUIRED

HttpStatus methods
------------------

[](#httpstatus-methods)

```
HttpStatus::isInformational(int $status): bool
```

The request was received, continuing process.

```
HttpStatus::isSuccessful(int $status): bool
```

The request was successfully received, understood, and accepted.

```
HttpStatus::isRedirection(int $status): bool
```

Further action needs to be taken in order to complete the request.

```
HttpStatus::isClientError(int $status): bool
```

The request contains bad syntax or cannot be fulfilled.

```
HttpStatus::isServerError(int $status): bool
```

The server failed to fulfill an apparently valid request.

```
HttpStatus::getReason(int $status): string
```

HTTP status reason phrase.

```
HttpStatus::getDescription(int $status): string
```

HTTP status description.

```
HttpStatus::getAllReasons(): string[]
```

All HTTP status codes (array keys) with reason phrases (array values).

```
HttpStatus::getAllDescriptions(): string[]
```

All HTTP status codes (array keys) with status descriptions (array values).

HttpStatusCode class
--------------------

[](#httpstatuscode-class)

You can use the **HttpStatusCode** class to represent any HTTP status code.

Example:

```
use Nullform\HttpStatusCode;

// some code...

$status = new HttpStatusCode($response->getStatusCode());

if ($status->isSuccessful()) {
    // some code...
} else {
    throw new \Exception($status->getReason() . '. ' . $status->getDescription());
}
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

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 ~282 days

Recently: every ~112 days

Total

8

Last Release

643d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.0

v1.3.0PHP ^7.0||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/04a9894c87cf7ea2b58fc41be2ebbb1a999e1906d209e146b0fc2fd9dd9b7b2e?d=identicon)[nullform](/maintainers/nullform)

---

Top Contributors

[![nullform](https://avatars.githubusercontent.com/u/4964609?v=4)](https://github.com/nullform "nullform (14 commits)")

---

Tags

http-status-codesphphttpstatushttp statuscodesstatus codesrfc9110http status codes

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel-lang/http-statuses

Translation of HTTP statuses

283.2M7](/packages/laravel-lang-http-statuses)

PHPackages © 2026

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