Monitor exception and report it to notification channels(Dump、Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、Zulip).
composer require guanguans/laravel-exception-notify --ansi -v
php artisan vendor:publish --provider="Guanguans\\LaravelExceptionNotify\\ExceptionNotifyServiceProvider" --ansi -v
config/exception-notify.php
and .env
file# EXCEPTION_NOTIFY_DEFAULTS=dingTalk,lark,mail,slack,telegram,...
EXCEPTION_NOTIFY_DEFAULTS=log,slack,weWork
EXCEPTION_NOTIFY_SLACK_WEBHOOK=https://hooks.slack.com/services/TPU9A9/B038KNUC0GY/6pKH3vfa3mjlUPcgLSjzR
EXCEPTION_NOTIFY_WEWORK_TOKEN=73a3d5a3-ceff-4da8-bcf3-ff5891778
php artisan exception-notify:test --ansi -v
discord | lark | |
---|---|---|
Modify the boot
method in the app/Providers/AppServiceProvider.php
file
<?php
use Guanguans\LaravelExceptionNotify\Facades\ExceptionNotify;
use Illuminate\Support\Arr;
public function boot(): void
{
ExceptionNotify::skipWhen(static fn (\Throwable $throwable) => Arr::first(
[
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Http\Exceptions\HttpResponseException::class,
],
static fn (string $exception): bool => $throwable instanceof $exception
));
}
Modify the boot
method in the app/Providers/AppServiceProvider.php
file
<?php
use Guanguans\LaravelExceptionNotify\Contracts\Channel;
use Guanguans\LaravelExceptionNotify\Facades\ExceptionNotify;
use Illuminate\Container\Container;
public function boot(): void
{
ExceptionNotify::extend('YourChannelName', function (Container $container): Channel {
return 'Instance of the `\Guanguans\LaravelExceptionNotify\Contracts\Channel`.';
});
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.