PHPackages                             designcise/bitframe-whoops - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. designcise/bitframe-whoops

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

designcise/bitframe-whoops
==========================

Whoops error handler middleware

v4.0.0(3y ago)11191[1 PRs](https://github.com/designcise/bitframe-whoops/pulls)MITPHPPHP &gt;=8.2CI failing

Since May 18Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/designcise/bitframe-whoops)[ Packagist](https://packagist.org/packages/designcise/bitframe-whoops)[ RSS](/packages/designcise-bitframe-whoops/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (9)Versions (16)Used By (0)

BitFrame\\Whoops
================

[](#bitframewhoops)

[![CI](https://github.com/designcise/bitframe-whoops/actions/workflows/ci.yml/badge.svg)](https://github.com/designcise/bitframe-whoops/actions/workflows/ci.yml)[![Maintainability](https://camo.githubusercontent.com/2c43649947b4f3f7c99e2da75cdb03112b4312243c7b44ca8947d0a90f1b1647/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31613765663164336462363837366638366562352f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/designcise/bitframe-whoops/maintainability)[![Test Coverage](https://camo.githubusercontent.com/24d65d68a07beb7f6756cf3e4820897038023c5cd41c5461009741bc1472aacf/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f31613765663164336462363837366638366562352f746573745f636f766572616765)](https://codeclimate.com/github/designcise/bitframe-whoops/test_coverage)

Whoops error handler middleware to handle application or middleware specific errors.

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

[](#installation)

```
$ composer require "designcise/bitframe-whoops"

```

Please note that this package requires PHP 8.2.0 or newer.

Quickstart
----------

[](#quickstart)

### Instantiating

[](#instantiating)

The constructor has the following signature:

```
new ErrorHandler(
    ResponseFactoryInterface,
    HandlerProviderNegotiator::class,
    [options],
);
```

1. The first argument to the constructor must be an instance of `Psr\Http\Message\ResponseFactoryInterface`;
2. The second argument to the constructor must be an implementation of `\BitFrame\Whoops\Provider\ProviderInterface`;
3. The third argument to the constructor is an optional array of options to specify the following:
    1. `catchGlobalErrors`: When set to `true` errors will be handled outside of current batch of middleware set.
    2. Other options are simply method names in `Whoops\Handler\*Handler.php` and `BitFrame\Whoops\Handler\*Handler.php`. For example, to set `Whoops\Handler\JsonResponseHandler::setJsonApi()` you would pass in: `['setJsonApi' => false]`, etc.

As a shortcut, you can also use the static method `ErrorHandler::fromNegotiator($factory, $options)`. This would use the `\BitFrame\Whoops\Provider\HandlerProviderNegotiator` by default.

### How to Run the Middleware

[](#how-to-run-the-middleware)

To run the middleware, simply pass in a `BitFrame\Whoops\ErrorHandler` instance to your middleware runner / dispatcher.

For example, to handle middleware-specific errors with `BitFrame\App` (or other PSR-15 dispatchers) it would look something like this:

```
use BitFrame\App;
use BitFrame\Emitter\SapiEmitter;
use BitFrame\Whoops\ErrorHandler;
use BitFrame\Whoops\Provider\HandlerProviderNegotiator;
use BitFrame\Factory\HttpFactory;

$app = new App();

$middleware = function () {
    throw new \Exception('hello world!');
};

$app->use([
    SapiEmitter::class,
    new ErrorHandler(HttpFactory::getFactory(), HandlerProviderNegotiator::class, [
        'addTraceToOutput' => true,
        'setJsonApi' => false,
    ]),
    $middleware,
]);

$app->run();
```

To handle global errors with `BitFrame\App` (or other PSR-15 dispatchers) it would look something like this:

```
use BitFrame\App;
use BitFrame\Whoops\ErrorHandler;
use BitFrame\Factory\HttpFactory;

$app = new App();

$app->run([
    ErrorHandler::fromNegotiator(HttpFactory::getFactory(), [
        'catchGlobalErrors' => true,
        'addTraceToOutput' => true,
        'setJsonApi' => false,
    ]),
]);

throw new \Exception('hello world!');
```

### How Does It Work?

[](#how-does-it-work)

The error handler middleware automatically determines the error handler to use based on the `Accept` header. The following error handler providers are included:

1. `BitFrame\Whoops\Provider\HtmlHandlerProvider` for `Whoops\Handler\PrettyPageHandler`;
2. `BitFrame\Whoops\Provider\JsonHandlerProvider` for `Whoops\Handler\JsonResponseHandler`;
3. `BitFrame\Whoops\Provider\JsonpHandlerProvider` for `BitFrame\Whoops\Handler\JsonpResponseHandler`;
4. `BitFrame\Whoops\Provider\TextHandlerProvider` for `Whoops\Handler\PlainTextHandler`;
5. `BitFrame\Whoops\Provider\XmlHandlerProvider` for `Whoops\Handler\XmlResponseHandler`;

Tests
-----

[](#tests)

To run the tests you can use the following commands:

CommandType`composer test`PHPUnit tests`composer style`CodeSniffer`composer md`MessDetector`composer check`PHPStanContributing
------------

[](#contributing)

- File issues at
- Issue patches to

Documentation
-------------

[](#documentation)

Complete documentation for v3 will be available soon.

License
-------

[](#license)

Please see [License File](LICENSE.md) for licensing information.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance50

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

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

Recently: every ~177 days

Total

12

Last Release

1095d ago

Major Versions

1.x-dev → 2.0.02020-05-11

2.x-dev → v3.5.02021-07-21

v3.6.0 → 4.x-dev2023-05-29

PHP version history (5 changes)1.0.0PHP &gt;=7.1.0

2.0.0PHP &gt;=7.4.0

v3.5.0PHP &gt;=8.0

v3.6.0PHP &gt;=8.1

4.x-devPHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8da96262286c45c3cbc9fb5e0cc6e3195ae967d8f3c2f58bbeaccf103ca4b16?d=identicon)[designcise](/maintainers/designcise)

---

Top Contributors

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

---

Tags

error-handlermiddlewarephppsr-15psr-7whoopswhoops-error-handler

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/designcise-bitframe-whoops/health.svg)

```
[![Health](https://phpackages.com/badges/designcise-bitframe-whoops/health.svg)](https://phpackages.com/packages/designcise-bitframe-whoops)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k13](/packages/tempest-framework)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[typo3/cms-core

TYPO3 CMS Core

3713.2M4.9k](/packages/typo3-cms-core)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.5k1.5M79](/packages/mcp-sdk)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5733.3M42](/packages/thecodingmachine-graphqlite)

PHPackages © 2026

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