cblink / laravel-bug-msg
Package description here.
Installs: 1 258
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- ext-json: *
- guzzlehttp/guzzle: ^6.0|^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^3.7|^3.8|^4.0|^5.0
- phpunit/phpunit: ^7.0|^8.5|^9.0
README
.
Installing
# laravel7以上使用2.0版本 $ composer require cblink/laravel-bug-msg ^2.0 -vvv # laravel5.5以上,7以下使用1.0版本 $ composer require cblink/laravel-bug-msg ^1.0 -vvv
Config
<?php return [ 'notify' => [ /* * 是否每次错误都通知(建议 false,否则可能会轰炸) */ 'every' => false, /* * 分钟单位,该区间同一错误只提醒一次 */ 'interval' => 5, ], 'cache' => [ 'prefix' => 'notice.exception.', ], // 配置信息 'config' => [ // 是否开启调试 'debug' => false, // 通知地址的key 'key' => '', // 通知地址的认证信息 'token' => '', ], ];
Usage
<?php use Cblink\BugMsg\ExceptionHelper; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler{ // ... /** * Report or log an exception. * * @param \Exception $exception * * @return void * @throws Exception */ public function report(Exception $exception) { if ($this->shouldReport($exception)) { /* 添加这段代码即可 start */ (new ExceptionHelper()) /* @var array $config 引用至配置部分 */ ->handle($exception, $config); /* end */ } parent::report($exception); } }
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT