PHPackages                             gino-pane/nano-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. gino-pane/nano-http-status

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

gino-pane/nano-http-status
==========================

Truly minimalistic and self-contained package to handle HTTP statuses and relevant description messages

v1.0.1(8y ago)4249[2 PRs](https://github.com/GinoPane/php-nano-http-status/pulls)1MITPHPPHP ^7.0CI failing

Since Dec 11Pushed 4y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (6)Used By (1)

PHP Nano Http Status
====================

[](#php-nano-http-status)

[![Latest Stable Version](https://camo.githubusercontent.com/e273fe463db6742aa26dc8ffaebc507ad5ef4b080bb3e11b86a10985f396a1eb/68747470733a2f2f706f7365722e707567782e6f72672f67696e6f2d70616e652f6e616e6f2d687474702d7374617475732f762f737461626c65)](https://packagist.org/packages/gino-pane/nano-http-status)[![Build Status](https://camo.githubusercontent.com/49fcbaf1da69edd8ed8adf3f85b68053032fbe1b93ff8d385f107d20d2baa1b4/68747470733a2f2f7472617669732d63692e6f72672f47696e6f50616e652f7068702d6e616e6f2d726573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/GinoPane/php-nano-rest)[![Maintainability](https://camo.githubusercontent.com/8071734fd9b066405582adaeb8ee890d339854f9eee865ff4c042a0eda1cf44e/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f66646162656337376131313935643336313163662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/GinoPane/php-nano-http-status/maintainability)[![Test Coverage](https://camo.githubusercontent.com/1b3e8d8a27a307bb05122e497b1d3716a8cd8dd204d113077c832303fa3346a4/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f66646162656337376131313935643336313163662f746573745f636f766572616765)](https://codeclimate.com/github/GinoPane/php-nano-http-status/test_coverage)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/602e828725bd9b2c09f3609de9d6e7def6374cf0e91d6bb5e7a5c461dddcf7f9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f47696e6f50616e652f7068702d6e616e6f2d687474702d7374617475732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GinoPane/php-nano-http-status/?branch=master)[![License](https://camo.githubusercontent.com/ee3e2c6c74cbc0ff4a4a32d6ed773f38755ca8545aff857992be467d711a5606/68747470733a2f2f706f7365722e707567782e6f72672f67696e6f2d70616e652f6e616e6f2d687474702d7374617475732f6c6963656e7365)](https://packagist.org/packages/gino-pane/nano-http-status)[![Total Downloads](https://camo.githubusercontent.com/710b77a9489218de24d5b227f0470d6c9c17e3dd69949c4076024b0a40cd3683/68747470733a2f2f706f7365722e707567782e6f72672f67696e6f2d70616e652f6e616e6f2d687474702d7374617475732f646f776e6c6f616473)](https://packagist.org/packages/gino-pane/nano-http-status)

Truly minimalistic and self-contained package to handle HTTP statuses and relevant description messages. Such packages as [Teapot](https://github.com/shrikeh/teapot) or [Httpstatus](https://github.com/lukasoppermann/http-status) are nice and famous, but still either too heavy and over-complicated or simply does not fit to Gino Pane's high code quality standards.

Requirements
============

[](#requirements)

- PHP &gt;= 7.0;

Features
========

[](#features)

- The full list of HTTP status codes as readable constants;
- relevant status messages;
- ability to customize messages;
- ability to easily detect the class of the status;
- no dependencies in production;
- integrated tools for code quality, testing and building docs.

Installation
============

[](#installation)

```
composer require gino-pane/nano-http-status

```

Basic Usage
===========

[](#basic-usage)

Check existence of the code (using numeric codes or nice readable constants):

```
(new NanoHttpStatus())->statusExists(200); //true
(new NanoHttpStatus())->statusExists(400); //true
(new NanoHttpStatus())->statusExists(451); //true
(new NanoHttpStatus())->statusExists(511); //true
(new NanoHttpStatus())->statusExists(522); //false

```

Detect the class of the code using code numbers:

```
(new NanoHttpStatus())->isInformational(NanoHttpStatus::HTTP_OK); //false
(new NanoHttpStatus())->isSuccess(202);         //true
(new NanoHttpStatus())->isRedirection(301);     //true
(new NanoHttpStatus())->isClientError(404);     //true
(new NanoHttpStatus())->isServerError(NanoHttpStatus::HTTP_BAD_REQUEST); //false

```

Get status message by status code:

```
(new NanoHttpStatus())->getMessage(200); //OK
(new NanoHttpStatus())->getMessage(451); //Unavailable For Legal Reasons
(new NanoHttpStatus())->getMessage(452); //Undefined Status

```

Set localization mapping and get custom status messages:

```
$status = new NanoHttpStatus([
    NanoHttpStatus::HTTP_BAD_REQUEST => 'Very bad request',
    NanoHttpStatus::HTTP_BAD_GATEWAY => 'Not so bad gateway'
]);

$status->getMessage(400); //'Very bad request'
$status->getMessage(502); //'Not so bad gateway'

```

Please note, that `NanoHttpStatus` itself does not throw any exceptions for invalid statuses.

Useful Tools
============

[](#useful-tools)

Running Tests:
--------------

[](#running-tests)

```
php vendor/bin/phpunit

```

or

```
composer test

```

Code Sniffer Tool:
------------------

[](#code-sniffer-tool)

```
php vendor/bin/phpcs --standard=PSR2 src/

```

or

```
composer psr2check

```

Code Auto-fixer:
----------------

[](#code-auto-fixer)

```
php vendor/bin/phpcbf --standard=PSR2 src/

```

or

```
composer psr2autofix

```

Building Docs:
--------------

[](#building-docs)

```
php vendor/bin/phpdoc -d "src" -t "docs"

```

or

```
composer docs

```

Changelog
=========

[](#changelog)

To keep track, please refer to [CHANGELOG.md](https://github.com/GinoPane/php-nano-http-status/blob/master/CHANGELOG.md).

Contributing
============

[](#contributing)

1. Fork it.
2. Create your feature branch (git checkout -b my-new-feature).
3. Make your changes.
4. Run the tests, adding new ones for your own code if necessary (phpunit).
5. Commit your changes (git commit -am 'Added some feature').
6. Push to the branch (git push origin my-new-feature).
7. Create new pull request.

Also please refer to [CONTRIBUTION.md](https://github.com/GinoPane/php-nano-http-status/blob/master/CONTRIBUTION.md).

License
=======

[](#license)

Please refer to [LICENSE](https://github.com/GinoPane/php-nano-http-status/blob/master/LICENSE).

Notes
=====

[](#notes)

Powered by [composer-package-template](https://github.com/GinoPane/composer-package-template)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

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

Total

3

Last Release

3070d ago

Major Versions

v0.1.0 → v1.0.02017-12-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/13784bcc3c69ea265648475d67e70d2fdb427207ba73f140ff29b1ff00e3e3ef?d=identicon)[GinoPane](/maintainers/GinoPane)

---

Top Contributors

[![GinoPane](https://avatars.githubusercontent.com/u/3897579?v=4)](https://github.com/GinoPane "GinoPane (3 commits)")

---

Tags

httphttp-status-codehttp-status-codeshttp-statuscodeshttpstatushttpstatus codehttp statushttp-status-codephp http statusphp http code

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/gino-pane-nano-http-status/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.1k](/packages/guzzlehttp-psr7)[psr/http-message

Common interface for HTTP messages

7.1k1.0B5.5k](/packages/psr-http-message)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k692.9M1.9k](/packages/psr-http-factory)[league/uri

URI manipulation library

1.1k206.4M276](/packages/league-uri)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[http-interop/http-factory-guzzle

An HTTP Factory using Guzzle PSR7

581167.2M519](/packages/http-interop-http-factory-guzzle)

PHPackages © 2026

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