laravel-exception-notify - 支持多种通
2021-07-06 本文已影响0人
guanguans
![](https://img.haomeiwen.com/i3827973/ebbf8e8a511239a3.png)
laravel-exception-notify - 支持多种通道的 laravel 异常监控通知(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)。
功能
- 监控发送 laravel 应用异常
- 支持多种通道(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)
- 自定义发送的异常信息数据
源码
相关项目
环境要求
- laravel >= 5.5
安装
$ composer require guanguans/laravel-exception-notify -vvv
配置
发布服务
$ php artisan vendor:publish --provider="Guanguans\\LaravelExceptionNotify\\ExceptionNotifyServiceProvider"
申请通道 token 等信息
配置文件中配置 token 等信息
config/exception-notify.php
使用
修改 app/Exceptions/Handler.php
文件中的 report
方法
public function report(Exception $exception)
{
// 添加的代码
$this->shouldReport($exception) and \ExceptionNotifier::report($exception);
// // 或者
// $this->shouldReport($exception) and app('exception.notifier')->report($exception);
// // 或者
// $this->shouldReport($exception) and \Guanguans\LaravelExceptionNotify\Facades\Notifier::report($exception);
parent::report($exception);
}
通知结果
![](https://img.haomeiwen.com/i3827973/ae52f261bdfd9062.png)
![](https://img.haomeiwen.com/i3827973/77043a164ddc06ea.png)
![](https://img.haomeiwen.com/i3827973/b1ba06e64a524a3a.png)
![](https://img.haomeiwen.com/i3827973/9af64ebff01ca5a1.png)