PHPackages                             evolcon/yii2-sentry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. evolcon/yii2-sentry

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

evolcon/yii2-sentry
===================

Yii2 sentry

2.0.0(5y ago)188PHPPHP &gt;=8.0.2

Since Nov 2Pushed 5y ago2 watchersCompare

[ Source](https://github.com/evolcon/yii2-sentry)[ Packagist](https://packagist.org/packages/evolcon/yii2-sentry)[ Docs](https://github.com/evolcon)[ RSS](/packages/evolcon-yii2-sentry/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (1)Versions (9)Used By (0)

[Sentry](https://sentry.io) logger extension for Yii2
=====================================================

[](#sentry-logger-extension-for-yii2)

---

Installation
------------

[](#installation)

```
composer require evolcon/yii2-sentry:@dev

```

Add SentryComponent to the the application config:

```
'components' => [
    'sentry' => [
        'class' => evolcon\sentry\SentryComponent::class,
        'dsn' => 'https://fsdhbk67bhkfa424eehb678agj66b7@sentry.io/2588150',
    ],
],

```

For disabling notification set `false` to attribute `enabled`

```
'components' => [
    'sentry' => [
        'class' => evolcon\sentry\SentryComponent::class,
        'dsn' => 'https://fsdhbk67bhkfa424eehb678agj66b7@sentry.io/2588150',
        'enabled' => false,
    ],
],

```

Add class SentryTarget attribute 'targets' for component 'log'

```
'components' => [
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'flushInterval' => 1,
        'targets' => [
            [
                'class' => evolcon\sentry\SentryTarget::class,
                'exportInterval' => 1,
                'levels' => ['error', 'warning'],
                'except' => [
                    'yii\web\HttpException:429', // TooManyRequestsHttpException
                    'yii\web\HttpException:401', // UnauthorizedHttpException
                ],
                'userData' => ['id', 'email', 'role'],
            ],
        ]
    ],
],

```

\#User data collecting

---

Add `userData` attribute to SentryTarget and array list of attributes which are needed to be collected

```
'components' => [
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'flushInterval' => 1,
        'targets' => [
            [
                'class' => evolcon\sentry\SentryTarget::class,
                'exportInterval' => 1,
                'levels' => ['error', 'warning'],
                'except' => [
                    'yii\web\HttpException:429', // TooManyRequestsHttpException
                    'yii\web\HttpException:401', // UnauthorizedHttpException
                ],
                'userData' => ['id', 'email', 'role'],
            ],
        ]
    ],
],

```

By default sentry target uses 'user' component of the application. If you need to override component, configure attribute `userComponent`

`NOTE: component must be an instance of \yii\web\User class`

```
'components' => [
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'flushInterval' => 1,
        'targets' => [
            [
                'class' => evolcon\sentry\SentryTarget::class,
                'userComponent' => 'user', //the component name
                'userData' => ['id', 'email', 'role'],
            ],
        ]
    ],
],

```

Sometimes we need to separate logs for example to separate `warning` and `error` and send them to different projects in sentry. For that we need to override SentryTarget's attribute `sentryComponent` , and set the component name which we needed

```
'components' => [
    'sentryWarnings' => [
        'class' => evolcon\sentry\SentryComponent::class,
        'dsn' => 'https://fsdhbk67bhkfa424eehb678agj66b7@sentry.io/55555555',
    ],
    'sentryErrors' => [
        'class' => evolcon\sentry\SentryComponent::class,
        'dsn' => 'https://fsdhbk67bhkfa424eehb678agj66b7@sentry.io/999999999',
    ],
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'flushInterval' => 1,
        'targets' => [
            [
                'class' => evolcon\sentry\SentryTarget::class,
                'sentryComponent' => 'sentryWarnings',
                'levels' => ['warning'], //only warnings
            ],
            [
                'class' => evolcon\sentry\SentryTarget::class,
                'sentryComponent' => 'sentryErrors',
                'levels' => ['error'], //only errors
            ],
        ]
    ],
],

```

Exception with tags
===================

[](#exception-with-tags)

```
use evolcon\sentry\SilentException;

throw (new SilentException('Error message'))
    ->addTag('tagName', 'tagValue')
    ->addTag('tagName2', 'tagValue')
    ->addExtra('extraName', 'extraValue')
    ->addExtra('extraName2', 'extraValue');

```

Multiple tags and extra

```
throw (new SilentException('Error message'))
    ->addTags(['tagName' => 'tagValue', 'tagName2' => 'tagValue'])
    ->addExtras(['extraName' => 'extraValue', 'extraName2' => 'extraValue']);

```

Exception without throwing is need sometimes when we need to debug our code and keep project fault tolerant. In this case you can create an instance of class SilentException and call method `save()`

```

try {

    // my code

} catch(\Throwable $e) {
    (new SilentException($e->getMessage()))
        ->addTags(['tagName' => 'tagValue', 'tagName2' => 'tagValue'])
        ->addExtras(['extraName' => 'extraValue', 'extraName2' => 'extraValue'])
        ->save(__METHOD__);
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~127 days

Total

8

Last Release

1874d ago

Major Versions

0.0.1 → v1.0.12019-11-02

1.1.2 → 2.0.02021-03-24

PHP version history (2 changes)0.0.1PHP &gt;=7.0.0

2.0.0PHP &gt;=8.0.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17050686?v=4)[олег](/maintainers/evolcon)[@evolcon](https://github.com/evolcon)

---

Top Contributors

[![evolcon](https://avatars.githubusercontent.com/u/17050686?v=4)](https://github.com/evolcon "evolcon (19 commits)")

---

Tags

phpsentryyii2evolcon

### Embed Badge

![Health badge](/badges/evolcon-yii2-sentry/health.svg)

```
[![Health](https://phpackages.com/badges/evolcon-yii2-sentry/health.svg)](https://phpackages.com/packages/evolcon-yii2-sentry)
```

###  Alternatives

[notamedia/yii2-sentry

Yii2 logger for Sentry

1272.0M2](/packages/notamedia-yii2-sentry)[mito/yii2-sentry

Yii 2 extension for Sentry

92377.7k](/packages/mito-yii2-sentry)[minbaby/hyperf-sentry

1926.7k](/packages/minbaby-hyperf-sentry)[friendsofhyperf/sentry

The sentry component for Hyperf.

1864.6k](/packages/friendsofhyperf-sentry)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
