lfelin/laravel-tracetoslack

将您的跟踪信息发送到Slack的一个频道

v1.0.1 2016-07-14 13:36 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:47:45 UTC


README

License Latest Stable Version Total Downloads

对于Laravel 4.2,请使用 4.2分支

关于

Trace to slack 是一个简单的Laravel包,用于在Slack https://slack.com/ 上通知您的应用程序错误

安装

使用Composer拉取此包。

    {
        "require": {
            "lfelin/laravel-tracetoslack": "1.*"
        }
    }

导出自动加载

composer dump-autoload -o

Laravel 5.* 集成

将服务提供者添加到您的 config/app.php 文件中

    'providers'     => array(

        //...
        Lfelin\TraceToSlack\TraceToSlackServiceProvider::class,

    ),

在您的 app/Exceptions/Handler.php 文件中

替换

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

use Lfelin\TraceToSlack\Handler as ExceptionHandler;

配置

发布配置

php artisan vendor:publish

在您的 config/tracetoslack.php 文件中配置参数。参数 webhook_url 是必需的

    return array(

        /*
         |--------------------------------------------------------------------------
         | Notify on debug
         |--------------------------------------------------------------------------
         | Default: false
         | The notifications are also sent if the debug mode is activated [true]
         |
         */

        'active_on_debug' => false,

        /*
         |--------------------------------------------------------------------------
         | Your private Webhook URL
         |--------------------------------------------------------------------------
         | [Required]
         | Eg: https://hooks.slack.com/services/XXX/XXX
         |
         */

        'webhook_url' => 'https://hooks.slack.com/services/XXX/XXX',

        /*
         |--------------------------------------------------------------------------
         | Username
         |--------------------------------------------------------------------------
         | [Optional]
         | Default: John Bot
         |
         */

        'username' => '',

        /*
         |--------------------------------------------------------------------------
         | Emoji
         |--------------------------------------------------------------------------
         | [Optional]
         | Default: ':warning:'
         | http://www.emoji-cheat-sheet.com/ for example
         |
         */

        'icon_emoji' => '', //  default: ':bug:' => http://www.emoji-cheat-sheet.com/

        /*
         |--------------------------------------------------------------------------
         | Emoji Url
         |--------------------------------------------------------------------------
         | [Optional]
         | This param increase icon_emoji
         | https://slack.com/img/icons/app-57.png for example
         |
         */

        'icon_url' => '',

        /*
         |--------------------------------------------------------------------------
         | Other Channel
         |--------------------------------------------------------------------------
         | [Optional]
         | Default: The default channel is the one set in the web Hook
         | This name start by '#' or '@' for Direct Message
         | Eg: #general - @username
         |
         */

        'other_channel' => '',
    );

创建入站WebHooks

创建一个新的webhook: https://my.slack.com/services/new/incoming-webhook/

文档: https://api.slack.com/custom-integrations

Slack示例

example

建议和问题

使用 github issues 提出改进或重新组装您的问题