xinningsu / thinkphp-bugsnag
BugSnag integration for ThinkPHP, BugSnag整合ThinkPHP。
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/xinningsu/thinkphp-bugsnag
Requires
- php: >=7.1
 - bugsnag/bugsnag: ^3.0
 - topthink/framework: ^6.0.0 || ^8.0.0
 
Requires (Dev)
- phpunit/phpunit: >=5.0
 - squizlabs/php_codesniffer: ^3.0
 
This package is auto-updated.
Last update: 2025-10-15 00:52:35 UTC
README
BugSnag integration for ThinkPHP, BugSnag整合ThinkPHP。
安装
composer require xinningsu/thinkphp-bugsnag
配置
- 
新建配置文件
config/bugsnag.php, 添加配置:return [ 'api_key' => 'your_bugsnag_api_key', // 必填,请替换你的 Bugsnag API Key ];
更多配置项请参考 bugsnag.php
 - 
打开
app/ExceptionHandle.php,新增两行代码class ExceptionHandle extends Handle { // 1. 新增下面这行代码 use \Sulao\ThinkBugsnag\BugsnagHandle; public function report(Throwable $exception): void { // 使用内置的方式记录异常日志 parent::report($exception); // 2. 在 report 方法里新增下面这行代码 $this->reportBugsnag($exception); } }
 
测试
可以在controller中加入下面代码,然后看是否能在 Bugsnag 上看到错误报告。
app()->get('bugsnag')->notifyException(new \Exception('test exception'));