pyaesoneaung/snippet-error-noti

Notify Laravel errors to Slack with a clean UI and include a code snippet.

v1.0.2 2023-12-13 16:03 UTC

This package is auto-updated.

Last update: 2024-12-08 23:47:54 UTC


README

Snippet Error Noti

GitHub Workflow Status Packagist Version

Snippet Error Noti

Notify Laravel errors to Slack with a clean UI and include a code snippet.

Installation

composer require pyaesoneaung/snippet-error-noti

.env

SNIPPET_ERROR_NOTI_ENABLE=true
SNIPPET_ERROR_NOTI_WEBHOOK=slack-webhook-url

You can learn how to obtain a webhook URL in the Slack API documentation. Under the hood, spatie/laravel-slack-alerts is utilized to communicate with Slack.

Usage

Enable the capture of exceptions for reporting to Slack by implementing the following change in your app/Exceptions/Handler.php file.

use SnippetErrorNoti;
use Throwable;

public function register(): void
{
    $this->reportable(function (Throwable $e) {
        SnippetErrorNoti::captureException($e);
    });
}

Testing

composer test