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

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

fl0v/yii2-rollbar
=================

Rollbar for Yii2

1.0.1(7y ago)011.7k↓77.5%1PHPPHP &gt;=7.1

Since Dec 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/fl0v/yii2-rollbar)[ Packagist](https://packagist.org/packages/fl0v/yii2-rollbar)[ Docs](http://github.com/fl0v/yii2-rollbar)[ RSS](/packages/fl0v-yii2-rollbar/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (4)Versions (3)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).

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

[](#installation)

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

To install, either run

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

```

or add

```
"fl0v/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' => 'fl0v\yii2\rollbar\RollbarLoader',
        'config' => [
            'environment' => '{your_environment}',
            'access_token' => '{rollber_access_token}',
            // other Rollbar config settings
        ],
    ],
]
```

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

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

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

```
'components' => [
    'errorHandler' => [
        'class' => 'fl0v\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 fl0v\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' => 'fl0v\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 `fl0v\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' => [
        ....
        'fl0v\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,
                    ],
                    'custom' => [
                        'myData' => 'asd',
                        'key' => uniqid(),
                    ],
                ];
            ],
        ],
    ],
],
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

Every ~90 days

Total

2

Last Release

2663d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

rollbarrollbar-jsrollbar-phpyii2yii2-error-handleryii2-extensionlogmonitoringdebugexceptionerroryii2rollbar

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[baibaratsky/yii2-rollbar

Rollbar for Yii2

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

Rollbar error monitoring integration for Laravel projects

14110.7M10](/packages/rollbar-rollbar-laravel)[analog/analog

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

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

Rollbar error monitoring integration for Laravel projects

3241.1M2](/packages/jenssegers-rollbar)

PHPackages © 2026

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