oponiti/whoops-slack

Whoops Slack Handler.

v0.3.0 2016-06-28 08:33 UTC

This package is not auto-updated.

Last update: 2020-02-27 01:12:07 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads License Build Status

'Whoops Slack' is a handler for Whoops. It sends message to Slack when error is occured.

Installing

Use Composer to install Whoops into your project:

composer require oponiti/whoops-slack

Usage

$client = new Maknz\Slack\Client('https://hooks.slack.com/services/T00000000/B00000000/xxxxxxxxxxxxxxxxxxxxxxxx', [
    'username' => 'your-user-name',
    'channel' => '#your-channel'
]);

$whoops = new Whoops\Run;
$whoops->pushHandler(new Oponiti\Whoops\SlackHandler($client));
$whoops->register();

Config

new Oponiti\Whoops\SlackHandler($client, [
    'template' => __DIR__ . '/other/yours.template.php',
    'max_array_depth' => 3,
    'max_array_count' => 5,
]);

max_array_depth

Array value's maximum depth. You will show the message like below.

max_array_depth = 2

Array[
    [depth1] => Array[
        [depth2] => Array[
            ...many depth...
        ],
    ],
],

max_array_count

Array value's maximum count. You will show the message like below.

max_array_count = 3

Array[
    [0] => Array[],
    [1] => Array[],
    [2] => Array[],
    ...many count...
],

Filter

$handler = new Oponiti\Whoops\SlackHandler($client);
$handler->filter(function (\Exception $exception, \Whoops\Exception\Inspector $inspector) {
    if ($exception instanceof \Some\Notice\Exception) {
        return false;
    }
    return true;
});

Offering Infomation

  • File name and line
  • Error message
  • $_SERVER
  • $_POST
  • $_GET
  • Backtrace