Yii2 wrap of Sentry PHP SDK
Note: This package is not supported properly
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist autoxloo/yii2-sentry "*"
or
composer require --prefer-dist autoxloo/yii2-sentry "*"
or add
"autoxloo/yii2-sentry": "*"
to the require section of your composer.json
file.
In your application config add:
// ...
'components' => [
// ...
'sentry' => [
'class' => \autoxloo\yii2\sentry\SentryComponent::class,
'ravenDsn' => 'https://0000000000000000000@sentry.io/000000', // Your sentry dsn
'allowCaptureMessage' => true,
],
],
Once the extension is installed, simply use it in your code by:
\Yii::$app->sentry->getRavenClient()->captureMessage('some message');
or
\Yii::$app->sentry->captureMessage('some message');
Note: In last example captures message only if
allowCaptureMessage
istrue
.
See sentry docs for more details https://docs.sentry.io/clients/php/