PHPackages                             bikashpoudel/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. bikashpoudel/error-handler

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

bikashpoudel/error-handler
==========================

Exception logger

1361PHP

Since Feb 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/bikashpoudel/zf2errorhandler)[ Packagist](https://packagist.org/packages/bikashpoudel/error-handler)[ RSS](/packages/bikashpoudel-error-handler/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#Installation Guide

- Add the erorr log configuration (application.local.php)

```
$mail = new \Zend\Mail\Message;
$mail->setFrom('bikash.poudel@grg.com');
$mail->setTo('bikash.poudel@grg.com');
$mail->setSubject('Important: Meeting room tool error!');
$mail->setEncoding('UTF-8');

return array(
    'exception_logger' => array(
        'writers' => array(
            'stream' => array(
                'name' => 'stream',
                'options' => array(
                    'stream' => 'php://output',//getcwd() . '/data/logs/' . date('Y-m-d') . '.error.log',
                    'formatter' => array(
                        'name'    => 'GrassRootsDms\ErrorHandler\Formatter\Generic',
                    ),
                ),
            ),
            'mail' => array(
                'name'    => 'mail',
                'options' => array(
                    'mail' => $mail,
                    'formatter' => array(
                        'name'    => 'GrassRootsDms\ErrorHandler\Formatter\Generic',
                    ),
                ),
            ),
        ),
    ),
);

```

- Add the error handler in your global config (global.php)

```
return array(
    'listeners' => array(
        'GrassRootsDms\ErrorHandler\ErrorHandler',
    ),
    'service_manager' => array(
        'factories' => array(
            'GrassRootsDms\Logger\Error'              => 'GrassRootsDms\ErrorHandler\Logger\Service\ErrorFactory',
            'GrassRootsDms\ErrorHandler\ErrorHandler' => 'GrassRootsDms\ErrorHandler\Service\ErrorHandlerFactory',
        ),
    ),
);

```

- Add your template for the fatal errors (global.php)

```
return array(
    'view_manager' => array(
        ...
        'template_map' => array(
                'error/fatal'             => __DIR__ . '../view/error/fatal.phtml',
        )
        ...
    ),
);

```

- error/fatal.html (view/error/fatal.html)

```

    We're sorry!

        *
        {
            color: #5e5e5e;
            font-family: Helvetica, arial, sans-serif;
            margin: 0px;
            padding: 0px;
        }
        #content
        {
            color: black;
            width: 500px;
            margin: 250px auto 0px auto;
        }
        #message
        {
            color: black;
            display: block;
            font-size: 18pt;
            font-weight: bold;
            letter-spacing: -1px;
            text-align: center;
        }
        #message .caption
        {
            color: black;
            display: block;
            font-size: .8em;
        }
        #error-reference
        {
            color: black;
            text-align: center;
        }
        b {
            display: none;
        }

        Oops
        Something went wrong. Please try again later.

        %__ERROR_REFERENCE__%

```

And thats it.. you now have a fully working error handler that logs the errors to either the file of your choice or to you email. Db formatter will follow up in newer versions!!

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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://www.gravatar.com/avatar/2006715c38b358c5fd73c5b7a3a6f857b02acab65b17dfa2e00161facd380e04?d=identicon)[hsakiib](/maintainers/hsakiib)

---

Top Contributors

[![poudelb](https://avatars.githubusercontent.com/u/5252288?v=4)](https://github.com/poudelb "poudelb (13 commits)")[![bikashpoudel](https://avatars.githubusercontent.com/u/4095823?v=4)](https://github.com/bikashpoudel "bikashpoudel (1 commits)")

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

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

API for OpenTelemetry PHP.

1938.5M263](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2326.5M317](/packages/open-telemetry-sdk)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8676.7k](/packages/illuminated-console-logger)

PHPackages © 2026

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