PHPackages                             murganikolay/debug-errorhook - 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. murganikolay/debug-errorhook

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

murganikolay/debug-errorhook
============================

Intercept PHP errors (including fatals) and process them (e.g. send to E-mail). Based on http://en.dklab.ru/lib/Debug\_ErrorHook/ by Dmitry Koterov

2.0.1(11y ago)0270LGPLPHPPHP &gt;=5.4.0

Since Feb 25Pushed 11y ago1 watchersCompare

[ Source](https://github.com/NikolayMurha/debug_errorhook)[ Packagist](https://packagist.org/packages/murganikolay/debug-errorhook)[ RSS](/packages/murganikolay-debug-errorhook/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

```
Debug_ErrorHook: Intercept PHP errors (including fatals) and process them (e.g. send to E-mail).
(C) Dmitry Koterov, http://en.dklab.ru/lib/Debug_ErrorHook/

This library allows to intercept PHP errors (including fatal!) with their
context (file name, line number, often - stack trace, environment etc.)
and do some work with this information. You may add any number of
hooks which will be called in case of errors.

The most common usage is to send PHP notices, warnings and even fatal
errors to developer's E-mail. Of course this sending is wise: if the
same error already happened within N seconds, it will not be resent,
so the mailbox is never overloaded, and sendmail program cannot crash
the whole system even if your site is very popular.

Commony errors and notices are sent to web server's logs and die there.
Nobody monitors server logs oftenly. If these errors are sent do developers'
emails, developers could react immediately and fix them. It is quite handy,
especially just after production deployment, and it works great especially
for fatal errors.

Usage sample
------------

Execute this in your script's bootstrap code:

  $errorsToMail = new Debug_ErrorHook_Listener();
  $errorsToMail->addNotifier(
      new Debug_ErrorHook_RemoveDupsWrapper(
          new Debug_ErrorHook_MailNotifier(
              "developer.email@example.com",
              Debug_ErrorHook_TextNotifier::LOG_ALL
          ),
          "/tmp/errors", // lock directory
          300            // do not resend the same error within 300 seconds
      )
  );

Or using factory:
$factory = new \Debug\ErrorHook\ErrorHookFactory();
$errorsToMail = $factory->create(require 'config/errorhook.php');

 // Attention! When $errorsToMail is destroyed (e.g. went out of
  // scope), error hooks are removed. Hooks are active till $errorsToMail's
  // destructor execution. So you should commonly save $errorsToMail somewhere
  // in a safe place (e.g. in $GLOBALS or in a class static property) and
  // be sure it is not destroyed until your script is finished.

Be sure to set error_reporting(E_ALL) to catch all notices. To test notice
emailing, execute something like:

  echo $non_existed_var;
  call_non_existed_function();

You will receve 2 mails at developer.email@example.com mailbox. First:

  From: developer.email@example.com
  To: developer.email@example.com
  Subject: [ERROR] E_NOTICE: Undefined variable: a at script.php on line 10

  //example.com/script.php?args
  E_NOTICE: Undefined variable: a
  at script.php on line 10

  TRACE:

  SERVER:

  COOKIES:

  GET:

  POST:

  SESSION:

Second mail will contain information about your fatal error. (Unfortunately
PHP does not allow to get stack trace for fatal errors, but other information
will be mailed correctly, including file name, line number and superglobals
state.)
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% 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 ~611 days

Total

2

Last Release

4265d ago

PHP version history (2 changes)2.0.0PHP 5.4.\*

2.0.1PHP &gt;=5.4.0

### Community

Maintainers

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

---

Top Contributors

[![NikolayMurha](https://avatars.githubusercontent.com/u/1524144?v=4)](https://github.com/NikolayMurha "NikolayMurha (7 commits)")[![dmitrymin](https://avatars.githubusercontent.com/u/1634111?v=4)](https://github.com/dmitrymin "dmitrymin (2 commits)")[![bladeofsteel](https://avatars.githubusercontent.com/u/296507?v=4)](https://github.com/bladeofsteel "bladeofsteel (1 commits)")[![dimikot](https://avatars.githubusercontent.com/u/65643?v=4)](https://github.com/dimikot "dimikot (1 commits)")

### Embed Badge

![Health badge](/badges/murganikolay-debug-errorhook/health.svg)

```
[![Health](https://phpackages.com/badges/murganikolay-debug-errorhook/health.svg)](https://phpackages.com/packages/murganikolay-debug-errorhook)
```

###  Alternatives

[psr/log

Common interface for logging libraries

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

API for OpenTelemetry PHP.

1941.5M276](/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)
