PHP code example of xinningsu / thinkphp-bugsnag
1. Go to this page and download the library: Download xinningsu/thinkphp-bugsnag library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xinningsu / thinkphp-bugsnag example snippets
return [
'api_key' => 'your_bugsnag_api_key', // 必填,请替换你的 Bugsnag API Key
];
class ExceptionHandle extends Handle
{
// 1. 新增下面这行代码
use \Sulao\ThinkBugsnag\BugsnagHandle;
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
// 2. 在 report 方法里新增下面这行代码
$this->reportBugsnag($exception);
}
}
app()->get('bugsnag')->notifyException(new \Exception('test exception'));