PHPackages                             slaveofcode/notifyexception - 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. slaveofcode/notifyexception

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

slaveofcode/notifyexception
===========================

A PHP Exception Handler to Post Exceptions to a messaging app channel like Slack.

v1.0.2(9y ago)013MITPHP

Since Dec 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/slaveofcode/notifyexception)[ Packagist](https://packagist.org/packages/slaveofcode/notifyexception)[ RSS](/packages/slaveofcode-notifyexception/feed)WikiDiscussions master Synced 2d ago

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

NotifyException for PHP
=======================

[](#notifyexception-for-php)

A PHP Exception Handler to Post Exceptions to a messaging app channel like Slack.

Currently supported messaging app
---------------------------------

[](#currently-supported-messaging-app)

- Slack (slack.com)
- RocketChat (rocket.chat)

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

[](#installation)

Install with composer

```
composer require slaveofcode/notifyexception

```

Then you can set the configuration on your startup or index file. `NotifyException` needs configuration set based on constants like this.

```
// Example Configuration
define('NOTIFY_EXCEPTION_SLACK', serialize([
    'webhook' => 'https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK',
    'channel' => 'my_awesome_channel',
    'username' => 'Taylor Swift' // optional
]));

define('NOTIFY_EXCEPTION_ROCKETCHAT', serialize([
    'webhook' => 'http://chat.myserver.com/hooks/HOOK_CODE/HOOK_CODE',
    // add attachment, all the options below are optional
    'title' => 'CRM ROBOT',
    'title_link' => 'http://crm2.jobs.id',
    'image_url' => 'http://i.imgur.com/wJAmxZ9.jpg'
]));

```

Then you can extends the Notify class by define your own class like this

```
class MyExceptionClass extends NotifyException
{
    /* Here you can override the message to fit your needs */
    protected function getTraceMessage()
    {
        $basicMessage = parent::getTraceMessage();

        // You also can append your custom message here
        $customMessage =
