atolye15/slack-exception-bundle

自动将所有异常推送到指定的Slack频道。

1.0.1 2016-03-10 12:52 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:51:11 UTC


README

此扩展包允许您将应用中所有的异常自动推送到任何Slack频道。

安装

首先,将依赖项添加到您的 composer.json 文件中。

"require": {
    ...
    "atolye15/slack-exception-bundle": "dev-master"
},

然后运行composer update命令。

php composer.phar update

最后,在您的kernel中启用此bundle。

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Atolye15\SlackExceptionBundle\Atolye15SlackExceptionBundle(),
    );
}

配置

在开始配置之前,您必须在Slack仪表板中创建一个新的Web API令牌。您可以从https://api.slack.com/web创建令牌。

以下是SlackExceptionBundle的完整配置:

atolye15_slack_exception:
    environment: prod # all or prod, default prod
    token: TOKEN # Your Slack token
    channel: general # Channel to publish
    username: APPException # Owner of message
    project: MyAwesomeProject # Identifier for your project
    throw_exception: false # Throw an error if Slack request fails. Default false
    request_timeout: 3000 # Timeout for Slack request. Set 0 for disable timeout. Default 3000