bing-leng-dt / laravel-exception-notify-xiavan
备注 此版本为学习为目的,不涉及任何第三方,如有侵权,请告知删除!
Fund package maintenance!
Wechat
Requires
- php: >=7.2
- guanguans/notify: ^1.0
- illuminate/bus: ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/contracts: ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/queue: ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^5.5 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.7
- friendsofphp/php-cs-fixer: ^2.16 || ^3.0
- mockery/mockery: ^1.2
- nyholm/nsa: ^1.2
- overtrue/phplint: ^2.4 || ^3.0
- phpbench/phpbench: ^1.0
- phpunit/phpunit: ^7.0 || ^8.0
- vimeo/psalm: ^4.0
This package is auto-updated.
Last update: 2025-02-24 15:19:20 UTC
README
Multiple channels of laravel exception notification(DingTalk、FeiShu、ServerChan、WeWork、XiZhi). - 多种通道的 laravel 异常通知。
功能
- 监控发送 laravel 应用异常
- 支持多种通道(钉钉群机器人、飞书群机器人、Server 酱、企业微信群机器人、息知)
- 自定义发送的异常信息数据
相关项目
环境要求
- laravel >= 5.5
安装
$ composer require bing-leng-dt/laravel-exception-notify-xiavan -vvv
配置
注册服务
laravel
$ php artisan vendor:publish --provider="Guanguans\\LaravelExceptionNotify\\ExceptionNotifyServiceProvider"
lumen
将以下代码段添加到 bootstrap/app.php
文件中的 Register Service Providers
部分下:
$app->register(\Guanguans\LaravelExceptionNotify\ExceptionNotifyServiceProvider::class);
申请通道 token 等信息
配置文件中配置 token 等信息
config/exception-notify.php
.env
文件中配置
EXCEPTION_NOTIFY_DEFAULT_CHANNEL=dingTalk EXCEPTION_NOTIFY_CHANNEL_KEYWORD=keyword EXCEPTION_NOTIFY_CHANNEL_TOKEN=fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73eeb EXCEPTION_NOTIFY_CHANNEL_SECRET=c32bb7345c0f73da2b9786f0f7dd5083bd768a29b82e6d460149d730eee51730
使用
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); }
通知结果
测试
$ composer test
变更日志
请参阅 CHANGELOG 获取最近有关更改的更多信息。
贡献指南
请参阅 CONTRIBUTING 有关详细信息。
安全漏洞
请查看我们的安全政策了解如何报告安全漏洞。
贡献者
协议
MIT 许可证(MIT)。有关更多信息,请参见协议文件。