eroteev / yii2-rollbar
Rollbar logging for Yii2 framework
Installs: 39 751
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.1
- rollbar/rollbar: ^1.6
- yiisoft/yii2: ^2.0.13
This package is not auto-updated.
Last update: 2025-05-17 16:59:03 UTC
README
Simplified rollbar monitoring integration for Yii2 applications.
Installation
The preferred way to install this extension is through composer.
To install add
"eroteev/yii2-rollbar": "^1.0.0"
to the require
section of your composer.json
file.
Setup instructions
- Add the component configuration in your global config file:
'bootstrap' => ['rollbar'], 'components' => [ 'rollbar' => [ 'class' => 'eroteev\rollbar\Rollbar', 'config' => [ 'access_token' => 'POST_SERVER_ITEM_ACCESS_TOKEN', ] ], ],
- Add the web error handler configuration in your web config file:
'components' => [ 'errorHandler' => [ 'class' => 'eroteev\rollbar\error_handler\WebErrorHandler' ], ],
- Add the console error handler configuration in your console config file:
'components' => [ 'errorHandler' => [ 'class' => 'eroteev\rollbar\error_handler\ConsoleErrorHandler' ], ],
- Add log target in your global config file:
'log' => [ 'targets' => [ [ 'class' => 'eroteev\rollbar\log\RollbarTarget', 'levels' => ['error'], // Log levels you want to appear in Rollbar 'categories' => ['application'], ], ], ],
Ignore specific exceptions
To ignore specific exceptions you can update the component configuration in your global config file:
'components' => [ 'rollbar' => [ 'class' => 'eroteev\rollbar\Rollbar', 'config' => [ // ... 'check_ignore' => function ($isUncaught, $toLog, $payload) { return eroteev\rollbar\helpers\IgnoreExceptionHelper::checkIgnore($toLog, [ ['yii\web\HttpException', 'statusCode' => [400, 404]], ['yii\db\Exception', 'getCode' => [2002]], ] ); } ] ], ],