2017 © Pedro Peláez
 

yii2-extension yii2-rollbar

Rollbar for Yii2

image

baibaratsky/yii2-rollbar

Rollbar for Yii2

  • Tuesday, May 8, 2018
  • by baibaratsky
  • Repository
  • 5 Watchers
  • 25 Stars
  • 25,008 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 5 Open issues
  • 20 Versions
  • 9 % Grown

The README.md

Rollbar for Yii2

Packagist Dependency Status Packagist Packagist, (*1)

This extension is the way to integrate Rollbar service with your Yii2 application. For Yii 1.* use yii-rollbar., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

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., (*4)

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

Usage

  1. Add the component configuration in your global main.php config file:, (*6)

    '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']],
         // ],
     ],
    ],
    
  2. Add the web error handler configuration in your web config file:, (*7)

    '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(),
         //     ];
         // },
     ],
    ],
    
  3. Add the console error handler configuration in your console config file:, (*8)

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

Payload from your exceptions

If you want your exceptions to send some additional data to Rollbar, it is possible by implementing the WithPayload interface. ```php use baibaratsky\yii\rollbar\WithPayload;, (*9)

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

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: ```php 'log' => [ 'targets' => [ [ 'class' => 'baibaratsky\yii\rollbar\log\Target', 'levels' => ['error', 'warning', 'info'], // Log levels you want to appear in Rollbar, (*11)

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

], ```, (*12)

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., (*13)

The Versions

08/05 2018

dev-master

9999999-dev http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

08/05 2018

v1.7.1

1.7.1.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

26/02 2018

v1.7.0

1.7.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

26/02 2018

v1.6.5

1.6.5.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

20/02 2018

v1.6.4

1.6.4.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

14/02 2018

v1.6.3

1.6.3.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

12/02 2018

v1.6.2

1.6.2.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

12/02 2018

v1.6.1

1.6.1.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

10/06 2017

v1.6.0

1.6.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

28/12 2016

v1.5.0

1.5.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

30/10 2016

v1.4.5

1.4.5.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

27/05 2016

v1.4.4

1.4.4.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

29/04 2016

v1.4.3

1.4.3.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

26/04 2016

v1.4.2

1.4.2.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

12/04 2016

v1.4.1

1.4.1.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

10/03 2016

v1.4.0

1.4.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

05/02 2016

v1.3.0

1.3.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

01/12 2015

v1.2.0

1.2.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

19/08 2015

v1.1.0

1.1.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io

31/07 2015

v1.0.0

1.0.0.0 http://github.com/baibaratsky/yii2-rollbar

Rollbar for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Andrei Baibaratsky

debug log yii2 exception yii error monitoring rollbar ratchetio ratchet.io