PHPackages                             oaksoftwaredev/yii2-rollbar - 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. oaksoftwaredev/yii2-rollbar

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

oaksoftwaredev/yii2-rollbar
===========================

Rollbar for Yii2

2.0.1(3y ago)02.0kPHPPHP &gt;=7.1

Since Sep 20Pushed 3y agoCompare

[ Source](https://github.com/OakSoftwareDev/yii2-rollbar)[ Packagist](https://packagist.org/packages/oaksoftwaredev/yii2-rollbar)[ Docs](http://github.com/oaksoftwaredev/yii2-rollbar)[ RSS](/packages/oaksoftwaredev-yii2-rollbar/feed)WikiDiscussions master Synced 1mo ago

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

Rollbar for Yii2
================

[](#rollbar-for-yii2)

This extension is a fork from [baibaratsky/yii2-rollbar](https://github.com/baibaratsky/yii2-rollbar) and [eroteev/yii2-rollbar](https://github.com/eroteev/yii2-rollbar). For Yii 1.x use [baibaratsky/yii-rollbar](https://github.com/baibaratsky/yii-rollbar).

2022-09-20 Forked to update rollbar version.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

To install, either run

```
$ php composer.phar require oaksoftwaredev/yii2-rollbar

```

or add

```
"oaksoftwaredev/yii2-rollbar": "*"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

- Add the component configuration in your **global** config file:

```
'components' => [
    'rollbar' => [
        'class' => 'oaksoftwaredev\yii2\rollbar\RollbarLoader',
        'config' => [
            'environment' => '{your_environment}',
            'access_token' => '{rollber_access_token}',
            'send_message_trace' => true,
            'include_exception_code_context' => true,
            'include_error_code_context' => true,
            'included_errno' => E_ALL,
            'enabled' => 'true',
            'check_ignore' => function($isUncaught, $toLog, $payload) {
               return \oaksoftwaredev\yii2\rollbar\helpers\IgnoreExceptionHelper::checkIgnore ($toLog, [
                   ['yii\web\HttpException', 'statusCode' => [400, 404]], // check properties
                ]);
            },
        ],
    ],
]
```

- Add the **web** error handler configuration in your **web** config file:

```
'components' => [
    'errorHandler' => [
        'class' => 'oaksoftwaredev\yii2\rollbar\handlers\WebErrorHandler',
    ],
],
```

- Add the **console** error handler configuration in your **console** config file:

```
'components' => [
    'errorHandler' => [
        'class' => 'oaksoftwaredev\yii2\rollbar\handlers\ConsoleErrorHandler',
    ],
],
```

Payload from your exceptions
----------------------------

[](#payload-from-your-exceptions)

If you want your exceptions to send some additional data to Rollbar, it is possible by implementing `PayloadInterface`.

```
use oaksoftwaredev\yii2\rollbar\PayloadInterface;

class SomeException extends \Exception implements PayloadInterface
{
    public function rollbarPayload()
    {
        return ['foo' => 'bar'];
    }
}
```

Log Target
----------

[](#log-target)

You may want to collect your logs produced by `Yii::error()`, `Yii::info()`, etc. in Rollbar.

Put the following code in your config:

```
'components' => [
    'log' => [
        'targets' => [
            [
                'class' => 'oaksoftwaredev\yii2\rollbar\RollbarTarget',
                'levels' => ['error', 'warning', 'info'], // Log levels you want to appear in Rollbar
                'categories' => ['application'],
            ],
        ],
    ],
],
```

Rollbar Javascript
------------------

[](#rollbar-javascript)

Rollbar offers Javascript debugger aswell, see . To use it in Yii2 there is `oaksoftwaredev\yii2\rollbar\RollbarAsset` that you can register in your main template.

RollbarAsset is used independently of the server side component, to configure it use assetManager. For the config part of RollbarAsset checkout Rollbar reference .

```
'assetManager' => [
    'bundles' => [
        'oaksoftwaredev\yii2\rollbar\RollbarAsset' => [
            // Rollbar configuration
            'config' => [
                'accessToken' => '{token}',
                'payload' => [
                    'environment' => '{environment}',
                ],
            ],
            // metrics to add to payload, called when the asset is registered
            'payload' => function () {
                return [
                    'person' => [
                        'id' => \Yii::$app->has('user') ? (string) \Yii::$app->user->id : null,
                        'username' => \Yii::$app->has('user') && ! \Yii::$app->user->isGuest ? \Yii::$app->user->identity->username : null,
                    ],
                ];
            },
        ],
    ],
],
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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 ~24 days

Recently: every ~30 days

Total

6

Last Release

1217d ago

Major Versions

1.0.2 → 2.0.12022-09-21

2.0.0 → v3.x-dev2023-01-17

PHP version history (2 changes)1.0.0PHP &gt;=7.1

2.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![OakSoftwareDev](https://avatars.githubusercontent.com/u/113594611?v=4)](https://github.com/OakSoftwareDev "OakSoftwareDev (13 commits)")[![fl0v](https://avatars.githubusercontent.com/u/7046246?v=4)](https://github.com/fl0v "fl0v (2 commits)")

---

Tags

logmonitoringdebugexceptionerroryii2rollbar

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/oaksoftwaredev-yii2-rollbar/health.svg)

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

###  Alternatives

[baibaratsky/yii2-rollbar

Rollbar for Yii2

35130.5k](/packages/baibaratsky-yii2-rollbar)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[jenssegers/rollbar

Rollbar error monitoring integration for Laravel projects

3301.1M2](/packages/jenssegers-rollbar)

PHPackages © 2026

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