for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Sulao\ThinkBugsnag;
use Bugsnag\Client;
use Bugsnag\Handler;
use think\Service;
class BugsnagService extends Service
{
public function boot()
$config = $this->app->config->get('bugsnag', []) + ['api_key' => null];
$bugsnag = Client::make($config['api_key']);
foreach ($config as $key => $value) {
$method = 'set' . implode('', array_map('ucfirst', explode('_', $key)));
if (method_exists($bugsnag, $method) && !is_null($value)) {
$bugsnag->$method($value);
}
Handler::register($bugsnag);
$this->app->bind('bugsnag', $bugsnag);