PHPackages                             mnhcc/ml-bugcatcher - 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. [Framework](/categories/framework)
4. /
5. mnhcc/ml-bugcatcher

ActiveLibrary[Framework](/categories/framework)

mnhcc/ml-bugcatcher
===================

Minimalus Layoutilus — error/exception handler with debug overlay and typed exception hierarchy

v1.0.0(2w ago)021LGPL-2.1-onlyPHPPHP &gt;=5.4CI passing

Since Apr 24Pushed 2w agoCompare

[ Source](https://github.com/MinimalusLayoutilus/ml-bugcatcher)[ Packagist](https://packagist.org/packages/mnhcc/ml-bugcatcher)[ Docs](https://github.com/carschrotter/ml-bugcatcher)[ RSS](/packages/mnhcc-ml-bugcatcher/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (4)Versions (5)Used By (1)

mnhcc/ml-bugcatcher
===================

[](#mnhccml-bugcatcher)

[![PHP 7.4](https://github.com/MinimalusLayoutilus/ml-bugcatcher/actions/workflows/ci-php74.yml/badge.svg)](https://github.com/MinimalusLayoutilus/ml-bugcatcher/actions/workflows/ci-php74.yml)[![PHP 8.1](https://github.com/MinimalusLayoutilus/ml-bugcatcher/actions/workflows/ci-php81.yml/badge.svg)](https://github.com/MinimalusLayoutilus/ml-bugcatcher/actions/workflows/ci-php81.yml)[![PHP 8.5](https://github.com/MinimalusLayoutilus/ml-bugcatcher/actions/workflows/ci-php85.yml/badge.svg)](https://github.com/MinimalusLayoutilus/ml-bugcatcher/actions/workflows/ci-php85.yml)

Error handling and exception classes for the Minimalus Layoutilus PHP framework.

Provides `Error` (error/exception handler with the BugCatcher debug overlay), `ExceptionEventParms` (the exception payload listened-to via the [ml-core](https://packagist.org/packages/mnhcc/ml-core) event bus), and a hierarchy of typed `Exception` classes.

Requirements
------------

[](#requirements)

- PHP ≥ 5.4
- [mnhcc/ml-core](https://packagist.org/packages/mnhcc/ml-core)

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

[](#installation)

```
composer require mnhcc/ml-bugcatcher
```

What you get
------------

[](#what-you-get)

### `Error` — central error / exception handler

[](#error--central-error--exception-handler)

Constructed by the framework bootstrap. Registers `set_error_handler`, `set_exception_handler` and `register_shutdown_function`, optionally starts an output buffer for blank-screen protection, and emits the BugCatcher debug overlay on the response when `DEBUG` is on.

```
// raise a 404 with the active Template (if any) so the response
// gets the configured error component instead of a hard die().
Error::getInstance()->raise(404, $previousException, '', $template);
```

### Exception hierarchy

[](#exception-hierarchy)

```
mnhcc\ml\classes\Exception                  base
└── HttpException                            carries an HTTP status code
    └── NotFoundException
        ├── ConfigNotFoundException          missing config key/file
        ├── ActionNotFoundException          unknown actionXxx() on a Control
        ├── ControllerNotFoundException      no Control{Segment} class for the URL
        ├── ViewNotFoundException
        ├── ComponentRendererNotFoundException
        ├── ComponentGetterNotCallableException
        ├── ModulRendererNotFoundException
        ├── ModulGetterNotFoundException
        └── ReflectionMethodException
    ├── ForbiddenException                   403
    ├── UnauthorizedException                401
    ├── RedirectException                    3xx
    └── RenderException                      generic render failure
└── ErrorException                           wraps PHP error_handler errors
└── BadFunctionCallException
└── InvalidArgumentException
└── NotImplementedException

```

`Programm::runn()` catches `HttpException` and routes to `Error::raise()`with the carried status code; concrete subclasses (`ConfigNotFoundException`, `ControllerNotFoundException`, …) preserve the original cause through PHP's standard `getPrevious()` chain.

### Events raised by this package

[](#events-raised-by-this-package)

The event bus itself lives in [ml-core](https://packagist.org/packages/mnhcc/ml-core). This package raises two events through it:

EventSourcePayload`exception``Error::handleException``ExceptionEventParms``shutdown``Error::shutdown``ExceptionEventParms``Error::__construct` also registers one listener — `Error::onTemplateCreated`— which adds `error` and `debug` styles to the active Template when the MVC package raises `templateCreated`.

BugCatcher debug overlay
------------------------

[](#bugcatcher-debug-overlay)

When `DEBUG` is on, `Error::documentPrepareHTML()` injects a debug overlay into the response so you don't have to scroll into framework internals to see what blew up.

### Layout

[](#layout)

- Wrapped in `` — explicitly NOT Bootstrap's `.container`, so the overlay always renders full-width regardless of the host page's CSS.
- White background, dark grey text, classic alert blocks, collapsible per-frame containers.
- Honours `prefers-color-scheme: dark` on browsers that support the media feature; IE11 ignores the dark block and stays on the light defaults.

### Exception chain

[](#exception-chain)

`renderError($exception, $hash)` walks `$exception->getPrevious()` and emits one frame per link, so wrapped exceptions surface the **whole** chain instead of only the outermost throw:

```
[hash] mnhcc\ml\classes\Exception\ControllerNotFoundException(404)        ← primary
       └─ Backtrace

[hash.1] Caused by: mnhcc\ml\classes\Exception\ConfigNotFoundException(404)  ← previous
         └─ Backtrace

```

The "Caused by:" frames are styled with `dbgHeader caused-by` (an orange left border, indented) so the chain is visually distinct from the primary throw.

### Browser compatibility

[](#browser-compatibility)

- IE11 supported — no CSS custom properties, no `:has()`, no `@supports`, classic media queries, plain RGB values.
- `prefers-color-scheme: dark` on Chrome 76+, Firefox 67+, Safari 12.1+, Edge 79+.

License
-------

[](#license)

[LGPL-2.1-only](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance96

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

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

Total

4

Last Release

20d ago

Major Versions

v0.9.2 → v1.0.02026-05-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4221960?v=4)[MNHcC (Michael Hegenbarth)](/maintainers/carschrotter)[@carschrotter](https://github.com/carschrotter)

---

Top Contributors

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

---

Tags

frameworkdebugexceptionserror-handler

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mnhcc-ml-bugcatcher/health.svg)

```
[![Health](https://phpackages.com/badges/mnhcc-ml-bugcatcher/health.svg)](https://phpackages.com/packages/mnhcc-ml-bugcatcher)
```

###  Alternatives

[graham-campbell/exceptions

Provides A Powerful Error Response System For Both Development And Production

5901.3M4](/packages/graham-campbell-exceptions)[lanin/laravel-api-debugger

Easily debug your JSON API.

2371.8M1](/packages/lanin-laravel-api-debugger)[lanin/laravel-api-exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

40103.7k](/packages/lanin-laravel-api-exceptions)[saad/api-debugger

Easily debug your JSON API.

1173.1k](/packages/saad-api-debugger)

PHPackages © 2026

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