PHPackages                             asminog/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. asminog/yii2-sentry

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

asminog/yii2-sentry
===================

Yii2 logger for Sentry

v1.2.0(1y ago)271MITPHPPHP &gt;=7.4CI passing

Since Feb 20Pushed 1y ago2 watchersCompare

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

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/ea054d2c001551350dc2c5048138ab594db6ee3ab97c4ec58bed45bfcad83b0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61736d696e6f672f796969322d73656e7472792e737667)](https://packagist.org/packages/asminog/yii2-sentry)[![Test](https://github.com/asminog/yii2-sentry/actions/workflows/php.yml/badge.svg)](https://github.com/asminog/yii2-sentry/actions/workflows/php.yml)[![License](https://camo.githubusercontent.com/4c3a1b453325b8fe582de0574d7be21094cc0ddf6df812654aab9c715700405a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f61736d696e6f672f796969322d73656e747279)](https://raw.githubusercontent.com/asminog/yii2-sentry/master/LICENSE)[![PHP from Packagist](https://camo.githubusercontent.com/9fedbcfe1da6f22ae6c1dcaccbcf9dc4225d524c13ae859345941b4f4ab21fc5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61736d696e6f672f796969322d73656e747279)](https://packagist.org/packages/asminog/yii2-sentry)[![Code Intelligence Status](https://camo.githubusercontent.com/b3c69395a0d6734f21231c66c79dfa3c511661b557fb4592fb9737dc4941fa76/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f61736d696e6f672f796969322d73656e7472792f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/g/asminog/yii2-sentry/)[![Scrutinizer code quality](https://camo.githubusercontent.com/c0521a2d77a3022b353b30fed0b2d1e63a075d0c57942aedca97eec156788040/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f61736d696e6f672f796969322d73656e747279)](https://scrutinizer-ci.com/g/asminog/yii2-sentry/)[![Downloads](https://camo.githubusercontent.com/a4adc40a56767ce62661d11bf39cfcbe44de70a5942a8266607214f173d9c80a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61736d696e6f672f796969322d73656e747279)](https://packagist.org/packages/asminog/yii2-sentry)

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

[](#installation)

```
composer require asminog/yii2-sentry
```

Add target class in the application config:

```
return [
    'components' => [
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'asminog\yii2sentry\SentryTarget',
                    'levels' => ['error', 'warning'],
                    'dsn' => 'https://88e88888888888888eee888888eee8e8@sentry.io/1',
//                    release option for project, default: 'auto'. Use "auto" to get it from git exec('git log --pretty="%H" -n1 HEAD')
                    'release' => 'my-project-name@2.3.12',
//                    Options for sentry client
                    'options' => [],
//                    Collect additional context from $_GLOBALS, default: ['_SESSION', 'argv']. To switch off set [].
                    /* @see https://docs.sentry.io/enriching-error-data/context/?platform=php#extra-context
                    'collectContext' => ['_SERVER', '_COOKIE', '_SESSION', 'argv'],
                    // user attributes to collect, default: ['id', 'username', 'email']. To switch off set [].
                    /* @see https://docs.sentry.io/enriching-error-data/context/?platform=php#capturing-the-user */
                    'collectUserAttributes' => ['userId', 'userName', 'email'],
                    // add something to extra using extraCallback, default: null
                    'extraCallback' => function ($message, $extra) {
                        $extra['YII_ENV'] = YII_ENV;
                        return $extra;
                    }
                ],
            ],
        ],
    ],
];
```

Usage
-----

[](#usage)

Writing simple message:

```
\Yii::error('message', 'category');
```

Writing messages with extra data:

```
\Yii::warning([
    'msg' => 'message',
    'extra' => 'value',
], 'category');
```

### Tags

[](#tags)

Writing messages with additional tags. If need to add additional tags for event, add `tags` key in message. Tags are various key/value pairs that get assigned to an event, and can later be used as a breakdown or quick access to finding related events.

Example:

```
\Yii::warning([
    'msg' => 'message',
    'extra' => 'value',
    'tags' => [
        'extraTagKey' => 'extraTagValue',
    ]
], 'category');
```

More about tags see

About
-----

[](#about)

Inspired by [notamedia/yii2-sentry](https://github.com/notamedia/yii2-sentry)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance44

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.1% 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 ~611 days

Total

4

Last Release

439d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

v1.2.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/5894be6e4c72e162373be54daa7cea5200d4a97c088c96f3f373328eb31ceff8?d=identicon)[asminog](/maintainers/asminog)

---

Top Contributors

[![asminog](https://avatars.githubusercontent.com/u/1555548?v=4)](https://github.com/asminog "asminog (33 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

sentryloggeryii2

###  Code Quality

TestsCodeception

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/asminog-yii2-sentry/health.svg)](https://phpackages.com/packages/asminog-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)[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3456.3k](/packages/lav45-yii2-activity-logger)

PHPackages © 2026

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