oponiti/whoops-slack

Whoops Slack 处理程序。

该软件包的官方仓库似乎已不存在,因此软件包已被冻结。

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' 是 Whoops 的处理程序。当发生错误时,它会向 Slack 发送消息。

安装

使用 Composer 将 Whoops 安装到您的项目中

composer require oponiti/whoops-slack

使用方法

$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();

配置

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

max_array_depth

数组值的最大深度。您将显示以下消息。

max_array_depth = 2

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

max_array_count

数组值的最大计数。您将显示以下消息。

max_array_count = 3

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

过滤器

$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;
});

提供信息

  • 文件名和行号
  • 错误消息
  • $_SERVER
  • $_POST
  • $_GET
  • 回溯