AfterBug for Yii Framework
, (*1)
This library detects errors and exceptions in your Yii Framework application and reports them to AfterBug for alerts and reporting., (*2)
Features
- Automatically report exceptions and errors
- Send customized diagnostic data
- Attach user information to determine how many people are affected by the error.
Installation
The preferred way to install this extension is through composer., (*3)
Either run, (*4)
composer require afterbug/afterbug-yii "~1.0"
or Add afterbug/afterbug-yii to your composer.json, (*5)
"afterbug/afterbug-yii": "~1.0"
Usage
Once the extension is installed, simply modify your application configuration as follows:, (*6)
$config = [
// ...
'components' => [
'afterbug' => [
'class' => 'AfterBug\AfterBugYii\AfterBug',
'apiKey' => 'YOUR_AFTERBUG_API_KEY',
],
// ...
'errorHandler' => [
'class' => 'AfterBug\AfterBugYii\Exceptions\ErrorHandler',
'errorAction' => 'site/error',
],
]
];
Exclude exceptions
$config = [
// ...
'components' => [
'afterbug' => [
'class' => 'AfterBug\AfterBugYii\AfterBug',
'apiKey' => 'YOUR_AFTERBUG_API_KEY',
'excludeExceptions' => ['yii\web\NotFoundHttpException']
],
]
];
Callbacks
Set a callback to customize the data., (*7)
$config = [
// ...
'components' => [
'afterbug' => [
'class' => 'AfterBug\AfterBugYii\AfterBug',
'apiKey' => 'YOUR_AFTERBUG_API_KEY',
'on beforeNotify' => function ($event) {
$event->client->setMetaData([
'custom' => 'Your custom data',
]);
}
],
]
];