lfelin/laravel-tracetoslack

Send your traceback on a channel of slack

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

This package is not auto-updated.

Last update: 2024-12-21 20:08:47 UTC


README

License Latest Stable Version Total Downloads

For Laravel 4.2, use the 4.2 branch

About

Trace to slack is a simple package for laravel to notify the errors of your application in slack https://slack.com/

Installation

Pull this package in through Composer.

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

Dump your autoload

composer dump-autoload -o

Laravel 5.* Integration

Add the service provider to your config/app.php file:

    'providers'     => array(

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

    ),

In your app/Exceptions/Handler.php file:

Replace

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

by

use Lfelin\TraceToSlack\Handler as ExceptionHandler;

Configuration

Publish configuration

php artisan vendor:publish

In your config/tracetoslack.php file configure the parameters. The parameter webhook_url is required :

    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' => '',
    );

Create Incoming WebHooks

Create a new webhook : https://my.slack.com/services/new/incoming-webhook/

Documentation : https://api.slack.com/custom-integrations

Example on slack

example

Suggestions and issues

Use github issues to suggest improvements or reassembling your problems