PHPackages                             avalanche-development/peel - 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. [Admin Panels](/categories/admin)
4. /
5. avalanche-development/peel

ActiveLibrary[Admin Panels](/categories/admin)

avalanche-development/peel
==========================

0.3.0(9y ago)13.2k6MITPHPPHP &gt;=5.6.0

Since Oct 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/avalanche-development/peel)[ Packagist](https://packagist.org/packages/avalanche-development/peel)[ RSS](/packages/avalanche-development-peel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (6)Used By (6)

peel
====

[](#peel)

An exception library that can be used to bubble up specific http errors through middleware.

[![Build Status](https://camo.githubusercontent.com/4e2fcbc92b8522e4dd38e8122b9ae055f0e87d8a87674b42bc4431a615a45846/68747470733a2f2f7472617669732d63692e6f72672f6176616c616e6368652d646576656c6f706d656e742f7065656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/avalanche-development/peel)[![Code Climate](https://camo.githubusercontent.com/a302f9b3a1ac4855fd4d99ccf3d31971a0c63b0f3bb3a3e049e7b8bfd5f1114e/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6176616c616e6368652d646576656c6f706d656e742f7065656c2f6261646765732f6770612e737667)](https://codeclimate.com/github/avalanche-development/peel)[![Test Coverage](https://camo.githubusercontent.com/0cc5372d6c61fabc86035885a899d46ae84e3d71b32393b5e003c366c309ae2f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6176616c616e6368652d646576656c6f706d656e742f7065656c2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/avalanche-development/peel/coverage)

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

[](#installation)

It's recommended that you use [Composer](https://getcomposer.org/) to install peel.

```
$ composer require avalanche-development/peel
```

peel requires PHP 5.6 or newer.

Usage
-----

[](#usage)

```
function someMiddleware($request, $response, $next) {
    $body = (string) $request->getBody();
    $body = json_decode($value);
    if (json_last_error() !== JSON_ERROR_NONE) {
        throw new AvalancheDevelopment\Peel\HttpError\BadRequest('Invalid JSON');
    }
    // etc
}
```

Each exception implements `AvalancheDevelopment\Peel\HttpErrorInterface`, which enforces two methods, `getStatusCode` and `getStatusMessage`. These give you the expected HTTP code and message for any sort of error handler.

### Exceptions

[](#exceptions)

- [BadRequest 400](src/HttpError/BadRequest.php)
- [Unauthorized 401](src/HttpError/Unauthorized.php)
- [PaymentRequired 402](src/HttpError/PaymentRequired.php)
- [Forbidden 403](src/HttpError/Forbidden.php)
- [NotFound 404](src/HttpError/NotFound.php)
- [MethodNotAllowed 405](src/HttpError/MethodNotAllowed.php)
- [NotAcceptable 406](src/HttpError/NotAcceptable.php)
- [ProxyAuthenticationRequired 407](src/HttpError/ProxyAuthenticationRequired.php)
- [RequestTimeout 408](src/HttpError/RequestTimeout.php)
- [Conflict 409](src/HttpError/Conflict.php)
- [Gone 410](src/HttpError/Gone.php)
- [LengthRequired 411](src/HttpError/LengthRequired.php)
- [PreconditionFailed 412](src/HttpError/PreconditionFailed.php)
- [RequestEntityTooLarge 413](src/HttpError/RequestEntityTooLarge.php)
- [RequestUriTooLong 414](src/HttpError/RequestUriTooLong.php)
- [UnsupportedMediaType 415](src/HttpError/UnsupportedMediaType.php)
- [RequestedRangeNotSatisfiable 416](src/HttpError/RequestedRangeNotSatisfiable.php)
- [ExpectationFailed 417](src/HttpError/ExpectationFailed.php)
- [UnprocessableEntity 422](src/HttpError/UnprocessableEntity.php)
- [Locked 423](src/HttpError/Locked.php)
- [PreconditionRequired 428](src/HttpError/PreconditionRequired.php)
- [TooManyRequests 429](src/HttpError/TooManyRequests.php)
- [RequestHeaderFieldsTooLarge 431](src/HttpError/RequestHeaderFieldsTooLarge.php)
- [UnavailableForLegalReasons 451](src/HttpError/UnavailableForLegalReasons.php)
- [InternalServerError 500](src/HttpError/InternalServerError.php)
- [NotImplemented 501](src/HttpError/NotImplemented.php)
- [BadGateway 502](src/HttpError/BadGateway.php)
- [ServiceUnavailable 503](src/HttpError/ServiceUnavailable.php)
- [GatewayTimeout 504](src/HttpError/GatewayTimeout.php)

Note: see [avalanche-development/crash-pad](https://github.com/avalanche-development/crash-pad) for an error handler that takes advantage of these standardized exceptions.

Development
-----------

[](#development)

This library is a work in progress - there may be additional options (like, error metadata) added for different statuses as needed.

### Tests

[](#tests)

To execute the test suite, you'll need phpunit (and to install package with dev dependencies).

```
$ phpunit
```

License
-------

[](#license)

peel is licensed under the MIT license. See [License File](LICENSE) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity52

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

5

Last Release

3471d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a4eb553ed7677c6aa2c5adb9d20191557e64369c14a9d4b2371c924c4517dff?d=identicon)[jacobemerick](/maintainers/jacobemerick)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/avalanche-development-peel/health.svg)

```
[![Health](https://phpackages.com/badges/avalanche-development-peel/health.svg)](https://phpackages.com/packages/avalanche-development-peel)
```

PHPackages © 2026

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