PHPackages                             vmpublishing/psr15-middleware-error-handler - 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. vmpublishing/psr15-middleware-error-handler

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

vmpublishing/psr15-middleware-error-handler
===========================================

dependency-less middleware to capture and process any throwable with a dedicated error handler

1.0.0(6y ago)0381MITPHPPHP &gt;=7.2

Since Jun 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/vmpublishing/psr15-middleware-error-handler)[ Packagist](https://packagist.org/packages/vmpublishing/psr15-middleware-error-handler)[ RSS](/packages/vmpublishing-psr15-middleware-error-handler/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/a9f0da8c7fcfc35bd0678525732d8b9acc32da57f0561fec8881c1e50200503f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f70737231352d6d6964646c65776172652d6572726f722d68616e646c65722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/psr15-middleware-error-handler/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/2bcf649feca00dc4c1d8fd3b7df823dd1182400abcd7774a23c2063319a3c367/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f70737231352d6d6964646c65776172652d6572726f722d68616e646c65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/psr15-middleware-error-handler/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2020b6a672b9bf2e0ccb5f1a2e5bde5bf424bead640ee2d9cfba324b74636705/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766d7075626c697368696e672f70737231352d6d6964646c65776172652d6572726f722d68616e646c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vmpublishing/psr15-middleware-error-handler/?branch=master)

**WHAT**

PSR-15 error handling middleware with as low dependencies as possible.

for productive use we like a middleware that captures and processes error into a nicer format (if possible)

this comes with two handler implementations. one just rethrow the error (for development purposes) one responds with the contents of a predefined file and a correct status code (for production use)

**INSTALL**

To install simply use `composer require vmpublishing/psr15-middleware-error-handler:*@stable`

**USE**

This is quite simple: define your handler and add the middleware;

```
use VM\ErrorHandler\Services\RethrowHandler;

$handler = new RethrowHandler();
$middleware = new ErrorProcessor($handler);

// and for slim, given $app
$app->add($middleware);

// or just add it on the routes you want it on

```

For the StaticFileHandler you need to pass in at least one file and an empty Response object;

```
use VM\ErrorHandler\Services\StaticFileHandler;

$handler = new StaticFileHandler('/path/to/500.html', $emptyResponse);
$middleware = new ErrorProcessor($handler);

// and for slim, given $app
$app->add($middleware);
// ...

```

To have specific ErrorCodes, you need to use the Http Exceptions from this library, ie: NotFound

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2522d ago

### Community

Maintainers

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

---

Tags

psr-7slimexceptionerrorpsr-15

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vmpublishing-psr15-middleware-error-handler/health.svg)

```
[![Health](https://phpackages.com/badges/vmpublishing-psr15-middleware-error-handler/health.svg)](https://phpackages.com/packages/vmpublishing-psr15-middleware-error-handler)
```

###  Alternatives

[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

586.6M81](/packages/laminas-laminas-stratigility)[middlewares/error-handler

Middleware to handle http errors

14104.2k13](/packages/middlewares-error-handler)[middlewares/whoops

Middleware to use Whoops as error handler

33205.4k24](/packages/middlewares-whoops)[jasny/auth

Authentication, authorization and access control for Slim Framework and other PHP micro-frameworks

11816.4k1](/packages/jasny-auth)[sunrise/http-router

A powerful solution as the foundation of your project.

16249.8k10](/packages/sunrise-http-router)

PHPackages © 2026

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