e96/yii2-sentry

A Yii2 client for Sentry (http://getsentry.com)

Installs: 49 850

Dependents: 0

Suggesters: 0

Security: 0

Stars: 32

Watchers: 9

Forks: 8

Open Issues: 0

Type:yii2-extension

0.2.0 2016-10-21 07:03 UTC

This package is not auto-updated.

Last update: 2020-07-10 18:20:35 UTC


README

##Install

php composer.phar require e96/yii2-sentry

Usage

In config file:

'bootstrap' => ['log', 'raven'],
'components' => [
    'raven' => [
        'class' => 'e96\sentry\ErrorHandler',
        'dsn' => '', // Sentry DSN
    ],
    'log' => [
        'targets' => [
            [
                'class' => 'e96\sentry\Target',
                'levels' => ['error', 'warning'],
                'dsn' => '', // Sentry DSN
            ]
        ],
    ],
]

You can provide additional information with exceptions:

SentryHelper::extraData($task->attributes);
throw new Exception('unknown task type');

Or just capture message with full stacktrace

try {
    throw new Exception('FAIL');
} catch (Exception $e) {
    SentryHelper::captureWithMessage('Fail to save model', $e);
}