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

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

otsec/yii2-sentry
=================

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

0.9.0(9y ago)02.0k[1 issues](https://github.com/otsec/yii2-sentry/issues)BSD-3-ClausePHP

Since Feb 28Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (2)Used By (0)

Yii2 Sentry Component
=====================

[](#yii2-sentry-component)

Automatically catch all PHP and JS errors and send them to [Sentry](https://sentry.io).

Supports [PHP SDK](https://github.com/getsentry/sentry-php) and [JavaScript Client](https://github.com/getsentry/raven-js).

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

[](#installation)

Install via [composer](http://getcomposer.org/download/).

```
composer require --prefer-dist otsec/yii2-sentry
```

Add component to your application configuration:

```
return [
    'components' => [
    	...

        'sentry' => [
            'class' => 'otsec\yii2\sentry\Raven',
            'dsn' => 'https://****@sentry.io/12345',
        ],
    ],
];
```

Do not forget to bootstrap it to register event handlers.

```
return [
    'bootstrap' => ['sentry'],

    ...
];
```

You are ready to go!

Configuration
-------------

[](#configuration)

There are a lot of options profived.

```
'components' => [
	...

    'sentry' => [
	    ...

	    // Register Raven_Client error and exception handler on init.
	    // Enabled by default
        'enableErrorHandler' => true,

        // Options will be passed to Raven_Client
        'options' => [],

        // Cathing JS errors is disabled by default.
        'enableClientScript' => false,

        // Options for client library.
        'clientOptions' => [],

        // DSN for client libary.
        // Will be extracted from private DSN if empty.
        'publicDsn' => null,

        // Client library will be loaded from CDN by default.
        // You can use any other asset bundle if you want.
        'assetBundle' => 'otsec\yii2\sentry\RavenCdnAsset',

        // Asset bundles for Bower and NPM already created but you have to
        // install assets before you will use it.
        // 'assetBundle' => 'otsec\yii2\sentry\RavenBowerAsset',
        // 'assetBundle' => 'otsec\yii2\sentry\RavenNpmAsset',
    ],
],
```

Usage
-----

[](#usage)

Component registers error handler by default. It will catch any appeared error or not captured exception.

Captured exceptions can be handled manually.

```
try {
	throw new Exception('Oh, shit!');
} catch (Exception $e) {
	Yii::$app->sentry->captureException($e, ['extra' => 'data']);
}
```

There are some methods to work with context.

```
Yii::$app->sentry->extraContext($data);
Yii::$app->sentry->tagsContext($data);
Yii::$app->sentry->userContext($data);
Yii::$app->sentry->clearContext();
```

Or you can get access to `Raven_Client` itself.

```
$ravenClient = Yii::$app->sentry->getClient();
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3366d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc3a6e11c22faa73408c450328aa48c255e50ae3b4a6793c4cc27d2561c125ae?d=identicon)[otsec](/maintainers/otsec)

---

Top Contributors

[![otsec](https://avatars.githubusercontent.com/u/1838504?v=4)](https://github.com/otsec "otsec (2 commits)")

---

Tags

crash-reportingerror-monitoringjavascriptphpsentryyii2errorsentryyii2ravencrash

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jenssegers/raven

Sentry (Raven) error monitoring integration for Laravel projects

90197.2k1](/packages/jenssegers-raven)[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[mito/yii2-sentry

Yii 2 extension for Sentry

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

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

2960.4k](/packages/e96-yii2-sentry)[facile-it/sentry-module

This module allows integration of Sentry Client into laminas and mezzio

19372.5k](/packages/facile-it-sentry-module)[oneup/contao-sentry-bundle

This bundle provides an easy integration of sentry.io for Contao 4.4.x and newer.

1114.8k](/packages/oneup-contao-sentry-bundle)

PHPackages © 2026

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