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

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

baibaratsky/yii2-rollbar
========================

Rollbar for Yii2

v1.9.1(2y ago)35130.5k—4.8%23BSD-3-ClausePHPPHP &gt;=8.0

Since Jul 31Pushed 2y ago4 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (24)Used By (0)

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

[](#rollbar-for-yii2)

[![Packagist](https://camo.githubusercontent.com/38daeb7b336bdd101922950ef082cfc20a34598a30758a7a351ca72e42550f34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6261696261726174736b792f796969322d726f6c6c6261722e737667)](https://github.com/baibaratsky/yii2-rollbar/blob/master/LICENSE.md)[![Dependency Status](https://camo.githubusercontent.com/c2713d728a3f706cc92524d94db4265e55c5ab4510ac44a4402023bcc744608f/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3535626136313330363533373632303031613030313839612f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/55ba6130653762001a00189a)[![Packagist](https://camo.githubusercontent.com/79a897858528ffbaa52288ec7ea74245dd9658310b5f77914264b5dc733b1f79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261696261726174736b792f796969322d726f6c6c6261722e737667)](https://packagist.org/packages/baibaratsky/yii2-rollbar)[![Packagist](https://camo.githubusercontent.com/db5f58d9ef31b50e3edb717fb05ce44dfa5b4748c9d68524b0b9909ca2ec4af9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261696261726174736b792f796969322d726f6c6c6261722e737667)](https://packagist.org/packages/baibaratsky/yii2-rollbar)

This extension is the way to integrate [Rollbar](http://rollbar.com/) service with your Yii2 application. For Yii 1.\* use [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 baibaratsky/yii2-rollbar:1.9.*

```

or add

```
"baibaratsky/yii2-rollbar": "1.9.*"

```

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

If you want to use it with **Yii prior to 2.0.13**, you need yii2-rollbar of the version `1.6.*`.

Usage
-----

[](#usage)

1. Add the component configuration in your *global* `main.php` config file:

```
'bootstrap' => ['rollbar'],
'components' => [
    'rollbar' => [
        'class' => 'baibaratsky\yii\rollbar\Rollbar',
        'accessToken' => 'POST_SERVER_ITEM_ACCESS_TOKEN',

        // You can specify exceptions to be ignored by yii2-rollbar:
        // 'ignoreExceptions' => [
        //         ['yii\web\HttpException', 'statusCode' => [400, 404]],
        //         ['yii\web\HttpException', 'statusCode' => [403], 'message' => ['This action is forbidden']],
        // ],
    ],
],
```

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

```
'components' => [
    'errorHandler' => [
        'class' => 'baibaratsky\yii\rollbar\web\ErrorHandler',

        // You can include additional data in a payload:
        // 'payloadDataCallback' => function (\baibaratsky\yii\rollbar\web\ErrorHandler $errorHandler) {
        //     return [
        //         'exceptionCode' => $errorHandler->exception->getCode(),
        //         'rawRequestBody' => Yii::$app->request->getRawBody(),
        //     ];
        // },
    ],
],
```

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

```
'components' => [
    'errorHandler' => [
        'class' => 'baibaratsky\yii\rollbar\console\ErrorHandler',
    ],
],
```

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 the `WithPayload` interface.

```
use baibaratsky\yii\rollbar\WithPayload;

class SomeException extends \Exception implements WithPayload
{
    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:

```
'log' => [
    'targets' => [
        [
            'class' => 'baibaratsky\yii\rollbar\log\Target',
            'levels' => ['error', 'warning', 'info'], // Log levels you want to appear in Rollbar

            // It is highly recommended that you specify certain categories.
            // Otherwise, the exceptions and errors handled by the error handlers will be duplicated.
            'categories' => ['application'],
        ],
    ],
],
```

The log target also appends `category` and `request_id` parameters to the log messages. `request_id` is useful if you want to have a *yii2-debug*-like grouping.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 70.3% 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 ~140 days

Recently: every ~520 days

Total

23

Last Release

853d ago

PHP version history (2 changes)v1.8.0PHP &gt;=7.1

v1.9.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f7d017b3e4596f4d1dd702da14192fd966e18ca3b21ba25b33f43803b2ce18a?d=identicon)[baibaratsky](/maintainers/baibaratsky)

---

Top Contributors

[![baibaratsky](https://avatars.githubusercontent.com/u/1774061?v=4)](https://github.com/baibaratsky "baibaratsky (26 commits)")[![crystinutzaa](https://avatars.githubusercontent.com/u/45258937?v=4)](https://github.com/crystinutzaa "crystinutzaa (3 commits)")[![friek108](https://avatars.githubusercontent.com/u/8036331?v=4)](https://github.com/friek108 "friek108 (1 commits)")[![gelige](https://avatars.githubusercontent.com/u/9049376?v=4)](https://github.com/gelige "gelige (1 commits)")[![lgelfan](https://avatars.githubusercontent.com/u/222257?v=4)](https://github.com/lgelfan "lgelfan (1 commits)")[![niektenhoopen](https://avatars.githubusercontent.com/u/3450011?v=4)](https://github.com/niektenhoopen "niektenhoopen (1 commits)")[![rokob](https://avatars.githubusercontent.com/u/831355?v=4)](https://github.com/rokob "rokob (1 commits)")[![skjb](https://avatars.githubusercontent.com/u/998458?v=4)](https://github.com/skjb "skjb (1 commits)")[![yumgame](https://avatars.githubusercontent.com/u/90189506?v=4)](https://github.com/yumgame "yumgame (1 commits)")[![code418](https://avatars.githubusercontent.com/u/316645?v=4)](https://github.com/code418 "code418 (1 commits)")

---

Tags

rollbaryii2yii2-extensionlogmonitoringdebugexceptionerroryii2yiirollbarratchetio

###  Code Quality

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[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)[crisu83/yii-sentry

Sentry for the Yii PHP framework.

1110.8k](/packages/crisu83-yii-sentry)

PHPackages © 2026

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