autoxloo/yii2-sentry

Yii2 wrap of Sentry PHP SDK

Installs: 13

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2019-02-26 13:17 UTC

This package is auto-updated.

Last update: 2024-03-19 20:56:52 UTC


README

Yii2 wrap of Sentry PHP SDK

Note: This package is not supported properly

Installation

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.

Config

In your application config add:

// ...
'components' => [
        // ...
        'sentry' => [
            'class' => \autoxloo\yii2\sentry\SentryComponent::class,
            'ravenDsn' => 'https://0000000000000000000@sentry.io/000000',          // Your sentry dsn
            'allowCaptureMessage' => true,
        ],
],

Usage

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 is true.

See sentry docs for more details https://docs.sentry.io/clients/php/