Downloads
Stars
Version
This library detects errors and exceptions in your Laravel application and reports them to AfterBug for alerts and reporting.
The preferred way to install this extension is through composer.
Either run
composer require afterbug/afterbug-laravel "~1.0"
or Add afterbug/afterbug-laravel
to your composer.json
"afterbug/afterbug-laravel": "~1.0"
If you're on Laravel 5.4 or earlier, you need to register the ServiceProvider in config/app.php
'providers' => [
// ...
AfterBug\AfterBugLaravel\AfterBugServiceProvider::class,
],
Publish the default configuration
php artisan vendor:publish --provider='AfterBug\AfterBugLaravel\AfterBugServiceProvider'
Add AfterBug reporting to app/Exceptions/Handler.php:
public function report(Exception $e)
{
if ($this->shouldReport($e)) {
AfterBug::catchException($e);
}
return parent::report($e);
}
Set a callback to customize the data.
AfterBug::registerCallback(function ($config) {
$config->setMetaData([
'custom' => 'Your custom data',
]);
})->catchException($e);
If you are using sentinel instead of laravel Auth, you have to setup user callback manually.
AfterBug::registerCallback(function ($config) {
if (Sentinel::check()) {
$config->setUser(
Sentinel::getUser()->toArray()
);
}
})->catchException($e);
AFTERBUG_API_KEY=Your_API_Key