PHPackages                             juliangut/http-exception - 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. juliangut/http-exception

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

juliangut/http-exception
========================

HTTP aware exceptions

0.1.1(8y ago)25.8kBSD-3-ClausePHPPHP ^7.0

Since Feb 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/juliangut/http-exception)[ Packagist](https://packagist.org/packages/juliangut/http-exception)[ Docs](https://github.com/juliangut/http-exception)[ RSS](/packages/juliangut-http-exception/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (15)Versions (3)Used By (0)

[![PHP version](https://camo.githubusercontent.com/b4cc5719a0e0694e7678ba6ade1a16ce21177baa7f8803d5a48465a4dac9689e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344372d3838393242462e7376673f7374796c653d666c61742d737175617265)](http://php.net)[![Latest Version](https://camo.githubusercontent.com/0e484c8337f4b5559302a5f8fbe86a26a5d191116b560875455082162bc6857d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/http-exception)[![License](https://camo.githubusercontent.com/70c2c1ff9943ddc8fe015d8fc22bac456924cc9edc53cf3e8c9ed28cf6564154/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/juliangut/http-exception/blob/master/LICENSE)

[![Build Status](https://camo.githubusercontent.com/82f17ca3f9bba4530c5a212e81a45dd9aa0be50ace387ea2a83039af1d23c4c5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/juliangut/http-exception)[![Style Check](https://camo.githubusercontent.com/e29582aa27ad1655d93f80ade4c59fe2345eecdeb319eee02ea952f1740f4858/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132313638343837342f736869656c64)](https://styleci.io/repos/121684874)[![Code Quality](https://camo.githubusercontent.com/e694cb9d87693723ea1272cfcdbc774d3b45e4a93d8509f9c4acea55089f9f3b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/juliangut/http-exception)[![Code Coverage](https://camo.githubusercontent.com/2f1c48d8f0d65dc4b7bbb5d5e78581a0c245f1b7a80e9e5b4d18f4c1f4d68ad3/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/juliangut/http-exception)

[![Total Downloads](https://camo.githubusercontent.com/d9ae18e7316adbdb965d25ebbbeadffe9e07691f450da73d021280a9b920eb79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/http-exception/stats)[![Monthly Downloads](https://camo.githubusercontent.com/6f121abc42327734ae1896a25b76f5de9b5d825deaf57bf725e36dbd23acb22e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6a756c69616e6775742f687474702d657863657074696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/http-exception/stats)

http-exception
==============

[](#http-exception)

HTTP aware exceptions

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

[](#installation)

### Composer

[](#composer)

```
composer require juliangut/http-exception

```

Usage
-----

[](#usage)

Require composer autoload file

```
require './vendor/autoload.php';
```

HTTP aware exceptions are just like normal exceptions but carrying an HTTP Status Code

```
use Jgut\HttpException\HttpException;

$exceptionMessage = 'You shall not pass!';
$exceptionDescription = 'You do not have permission';
$exceptionCode = 1001; // Internal code
$previousException = new \Exception();
$exception = new BadRequestHttpException($exceptionMessage, $exceptionDescription, $exceptionCode, $previousException);

$exception->getStatusCode(); // 400 Bad Request
```

Additionally exceptions have a description and a unique identifier which can be used in logging and displaying for example on APIs, allowing you to have more information over the erroneous situation when addressed

```
$exception->getDescription();
$exception->getIdentifier();
```

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

[](#contributing)

Found a bug or have a feature request? [Please open a new issue](https://github.com/juliangut/http-exception/issues). Have a look at existing issues before.

See file [CONTRIBUTING.md](https://github.com/juliangut/http-exception/blob/master/CONTRIBUTING.md)

License
-------

[](#license)

See file [LICENSE](https://github.com/juliangut/http-exception/blob/master/LICENSE) included with the source code for a copy of the license terms.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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

2

Last Release

3049d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c50421f1ab4148354dc2dd5dcaba168656b17ea913b310d112deb39a6f73ca1?d=identicon)[juliangut](/maintainers/juliangut)

---

Top Contributors

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

---

Tags

httpexception

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/juliangut-http-exception/health.svg)

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

###  Alternatives

[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78127.2M452](/packages/react-http)[mezzio/mezzio

PSR-15 Middleware Microframework

3903.8M120](/packages/mezzio-mezzio)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

577.0M95](/packages/laminas-laminas-stratigility)[sunrise/http-router

A powerful solution as the foundation of your project.

17450.9k10](/packages/sunrise-http-router)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10139.4k5](/packages/bitrix24-b24phpsdk)

PHPackages © 2026

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