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
Requires
- php: ^8.1
- illuminate/contracts: ^9.0|^10.0|^11.0
- spatie/backtrace: ^1.2.0
- spatie/laravel-package-tools: ^1.0.0
- spatie/laravel-slack-alerts: ^1.2.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
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