PHPackages                             hexa2k9/exception-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. hexa2k9/exception-handler

AbandonedArchivedLibrary

hexa2k9/exception-handler
=========================

A PHP Exception Handler to Post Exceptions to a Slack Channel

v2.0.3(11y ago)151604[1 PRs](https://github.com/hexa2k9/ExceptionHandler/pulls)MITPHPPHP &gt;=5.3.0

Since Mar 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/hexa2k9/ExceptionHandler)[ Packagist](https://packagist.org/packages/hexa2k9/exception-handler)[ RSS](/packages/hexa2k9-exception-handler/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

ExceptionHandler
================

[](#exceptionhandler)

A PHP Exception Handler to Post Exceptions to a Slack Channel

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

[](#installation)

- make sure your PHP Installation has `curl` loaded
- create a Channel on Slack
- create an Incoming Webook for your Slack Channel &amp; copy the Integration Token.
- add the [Packagist Package](https://packagist.org/packages/hexa2k9/exception-handler) to your `composer.json`
- run `composer update`

Configuration
-------------

[](#configuration)

You need to configure this Class before you can use it:

```
ExceptionHandler::configure(
    array(
        'username'       => 'company',                  // Your Slack Subdomain (e.g. company.slack.com)
        'token'          => '',             // The Slack Integration Token
        'data_path'      => '/tmp',                     // The Path to store full Exception Traces in
        'webhookChannel' => '#exceptions',              // Your Slack Channel
        'webhookUser'    => 'exception',                // The Username who will post Messages
        'webhookIcon'    => ':ghost:',                  // The Icon for the Username (can be :ghost: or an URL)
        'hostname'       => php_uname('n'),             // The Hostname your Application is running on
        'version'        => '1.0.0',                    // Your Application Version
        'env'            => 'production'                // The Applications Environment (e.g. production or development)
    )
);
```

And finally set the Exception Handler:

```
set_exception_handler(array('\ExceptionHandler', 'handleException'));
```

You will start to get Messages like these in your Channel:

> chrisbookair.local/2.0.81@development: uncaught Exception in file /Users/christian/Code/PhpstormProjects/api-v2/app/Classes/Util/GeneralUtility.php on line 581 (Code: 8 - Trace: handleException.1395606690.trace.532f44a20d0cc.txt): Memcache::connect(): Server 127.0.0.1 (tcp 11211) failed with: Connection refused (61)

ExceptionHandler will quit your current Applications run and returns a `json_encode()`d Message

```
{
  "status": 500,
  "message": "Okay, Houston, we've had a problem here. -- Don't panic. The Team has been notified."
}
```

other Usage
-----------

[](#other-usage)

By default this ExceptionHandler will care about uncaught Exceptions. If you want to send Slack Messages for Exceptions you handled you can use this like `\ExceptionHandler::handleException($exception, true);` to get notified. ExceptionHandler will not `die()` in this case.

You can even use ExdeptionHandler to just send Notifications. This feels a little weired however: `\ExceptionHandler::handleException(new \Exception('I\'m some text to send to Slack.'), true)`;

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~22 days

Recently: every ~39 days

Total

8

Last Release

4272d ago

Major Versions

v1.1.2 → v2.0.02014-03-30

### Community

Maintainers

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

---

Top Contributors

[![hexa2k9](https://avatars.githubusercontent.com/u/118494?v=4)](https://github.com/hexa2k9 "hexa2k9 (6 commits)")[![iamcal](https://avatars.githubusercontent.com/u/173750?v=4)](https://github.com/iamcal "iamcal (1 commits)")

### Embed Badge

![Health badge](/badges/hexa2k9-exception-handler/health.svg)

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

PHPackages © 2026

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