PHPackages                             studiow/http-exceptions - 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. studiow/http-exceptions

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

studiow/http-exceptions
=======================

HTTP exceptions

v1.0.3(3y ago)02.7k1MITPHPPHP ^7.4 || ^8.0

Since Jun 21Pushed 3y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (4)Versions (5)Used By (1)

Http Exceptions
===============

[](#http-exceptions)

A helper package for throwing HTTP Exceptions (4xx - 5xx)

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

[](#installation)

The easiest way to install this package is using composer:

```
composer require studiow/http-exceptions
```

Throwing exceptions
-------------------

[](#throwing-exceptions)

The package provides dedicated Exceptions for each of the 4xx and 5xx error status codes. You throw them like you would throw any other exception:

```
if (! file_exists($my_file)){
  throw new \Studiow\Http\Exceptions\ClientError\NotFoundException();
}
```

Outputting to Json
------------------

[](#outputting-to-json)

All of the exceptions have a toJsonResponse method. This method expects a PSR-7 ResponseInterface object and will return a a PSR-7 ResponseInterface object with the appropriate headers, status code and reason phrase set.

```
$exception = new \Studiow\Http\Exceptions\ClientError\NotFoundException();

/* convert the exception to a ResponseInterfaceObject */
$response = $exception->toJsonResponse(new \GuzzleHttp\Psr7\Response());
```

Exception overview
------------------

[](#exception-overview)

### Client Error (4xx)

[](#client-error-4xx)

Status CodeReason PhraseClass name400Bad Request\\Studiow\\Http\\Exceptions\\ClientError\\BadRequestException401Unauthorized\\Studiow\\Http\\Exceptions\\ClientError\\UnauthorizedException402Payment Required\\Studiow\\Http\\Exceptions\\ClientError\\PaymentRequiredException403Forbidden\\Studiow\\Http\\Exceptions\\ClientError\\ForbiddenException404Not Found\\Studiow\\Http\\Exceptions\\ClientError\\NotFoundException405Method Not Allowed\\Studiow\\Http\\Exceptions\\ClientError\\MethodNotAllowedException406Not Acceptable\\Studiow\\Http\\Exceptions\\ClientError\\NotAcceptableException407Proxy Authentication Required\\Studiow\\Http\\Exceptions\\ClientError\\ProxyAuthenticationRequiredException408Request Timeout\\Studiow\\Http\\Exceptions\\ClientError\\RequestTimeoutException409Conflict\\Studiow\\Http\\Exceptions\\ClientError\\ConflictException410Gone\\Studiow\\Http\\Exceptions\\ClientError\\GoneException411Length Required\\Studiow\\Http\\Exceptions\\ClientError\\LengthRequiredException412Precondition Failed\\Studiow\\Http\\Exceptions\\ClientError\\PreconditionFailedException413Payload Too Large\\Studiow\\Http\\Exceptions\\ClientError\\PayloadTooLargeException414URI Too Long\\Studiow\\Http\\Exceptions\\ClientError\\URITooLongException415Unsupported Media Type\\Studiow\\Http\\Exceptions\\ClientError\\UnsupportedMediaTypeException416Range Not Satisfiable\\Studiow\\Http\\Exceptions\\ClientError\\RangeNotSatisfiableException417Expectation Failed\\Studiow\\Http\\Exceptions\\ClientError\\ExpectationFailedException418I'm a Teapot\\Studiow\\Http\\Exceptions\\ClientError\\ImaTeapotException421Misdirected Request\\Studiow\\Http\\Exceptions\\ClientError\\MisdirectedRequestException422Unprocessable Entity\\Studiow\\Http\\Exceptions\\ClientError\\UnprocessableEntityException423Locked\\Studiow\\Http\\Exceptions\\ClientError\\LockedException424Failed Dependency\\Studiow\\Http\\Exceptions\\ClientError\\FailedDependencyException425Too Early\\Studiow\\Http\\Exceptions\\ClientError\\TooEarlyException426Upgrade Required\\Studiow\\Http\\Exceptions\\ClientError\\UpgradeRequiredException428Precondition Required\\Studiow\\Http\\Exceptions\\ClientError\\PreconditionRequiredException429Too Many Requests\\Studiow\\Http\\Exceptions\\ClientError\\TooManyRequestsException431Request Header Fields Too Large\\Studiow\\Http\\Exceptions\\ClientError\\RequestHeaderFieldsTooLargeException451Unavailable For Legal Reasons\\Studiow\\Http\\Exceptions\\ClientError\\UnavailableForLegalReasonsException### Server Error (5xx)

[](#server-error-5xx)

Status CodeReason PhraseClass name501Not Implemented\\Studiow\\Http\\Exceptions\\ServerError\\NotImplementedException502Bad Gateway\\Studiow\\Http\\Exceptions\\ServerError\\BadGatewayException503Service Unavailable\\Studiow\\Http\\Exceptions\\ServerError\\ServiceUnavailableException504Gateway Timeout\\Studiow\\Http\\Exceptions\\ServerError\\GatewayTimeoutException505HTTP Version Not Supported\\Studiow\\Http\\Exceptions\\ServerError\\HTTPVersionNotSupportedException506Variant Also Negotiates\\Studiow\\Http\\Exceptions\\ServerError\\VariantAlsoNegotiatesException507Insufficient Storage\\Studiow\\Http\\Exceptions\\ServerError\\InsufficientStorageException508Loop Detected\\Studiow\\Http\\Exceptions\\ServerError\\LoopDetectedException510Not Extended\\Studiow\\Http\\Exceptions\\ServerError\\NotExtendedException511Network Authentication Required\\Studiow\\Http\\Exceptions\\ServerError\\NetworkAuthenticationRequiredException

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

1386d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b57a4311f92e06e73f6c646344a069d0088747f22e420a583f91bd3e6ab1729?d=identicon)[studiowbe](/maintainers/studiowbe)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/studiow-http-exceptions/health.svg)

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

###  Alternatives

[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[http-interop/response-sender

A function to convert PSR-7 Response to HTTP output

46711.5k40](/packages/http-interop-response-sender)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

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