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

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

confetticode/error-handler
==========================

A great unified error handler for PHP

00PHP

Since Jun 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/confetticode/error-handler)[ Packagist](https://packagist.org/packages/confetticode/error-handler)[ RSS](/packages/confetticode-error-handler/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

A great unified error handler for PHP
=====================================

[](#a-great-unified-error-handler-for-php)

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

[](#installation)

Install `confetticode/error-handler` as a Composer dependency in your project.

```
composer require confetticode/error-handler
```

Usage
-----

[](#usage)

Create a new instance of the `ErrorHandler` class. By default, `HtmlDisplayer` will be initialized. This will display an error html page with status code, message and short description.

```
$errors = new \Confetti\ErrorHandler\ErrorHandler();
```

Register the `$errors` instance as the global error handler by doing some logic with `set_error_handler`, `set_exception_handler` and `register_shutdown_function`. Then, any uncaught errors/exceptions will be handled.

```
$errors->register();
```

You can change displayer by calling the `setDisplayer` method.

```
// Natively available.
$errors->setDisplayer(new \ConfetiCode\ErrorHandler\SymfonyDisplayer);

// To use IgnitionDisplayer, you have to install "spatie/ignition".
$errors->setDisplayer(new \ConfetiCode\ErrorHandler\IgnitionDisplayer);
```

Integrate with `monolog/monolog`, eg: writing logs into files.

```
composer require monolog/monolog
```

```
$logger = new \Monolog\Logger('testing');

$logger->setHandlers([
    new \Monolog\Handler\StreamHandler(__DIR__.'/log.txt'),
]);

$reporter = new \ConfettiCode\ErrorHandler\LogReporter($logger);

$errors->setReporter($reporter);
```

You may try out [error.php](./sample/error.php) file for a quick overview.

License
-------

[](#license)

The `confetticode/error-handler` package is licensed under the [MIT license](./LICENSE.md).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16967350?v=4)[Oliver Quynh](/maintainers/oliverquynh)[@oliverquynh](https://github.com/oliverquynh)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/confetticode-error-handler/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M277](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M343](/packages/open-telemetry-sdk)

PHPackages © 2026

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