All Projects → baibaratsky → yii2-rollbar

baibaratsky / yii2-rollbar

Licence: other
Rollbar for Yii2

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yii2-rollbar

install
basic script for project installation
Stars: ✭ 17 (-52.78%)
Mutual labels:  yii2, yii2-extension
yii2-linkable-behavior
Yii2 behavior to help creating urls easier
Stars: ✭ 12 (-66.67%)
Mutual labels:  yii2, yii2-extension
yii2-lets-talk
With this extension you can open chat with someone in popular messengers using the link on your website.
Stars: ✭ 15 (-58.33%)
Mutual labels:  yii2, yii2-extension
yii2-jwt-tools
An easy way to configure JWT authentication and validation on Yii Framework 2 Projects
Stars: ✭ 22 (-38.89%)
Mutual labels:  yii2, yii2-extension
ar-search
Provides unified search model for Yii ActiveRecord
Stars: ✭ 31 (-13.89%)
Mutual labels:  yii2, yii2-extension
Ar Softdelete
Soft delete behavior for ActiveRecord
Stars: ✭ 188 (+422.22%)
Mutual labels:  yii2, yii2-extension
yii2-mailqueue
Yii2 mail queue component for yii2-swiftmailer.
Stars: ✭ 15 (-58.33%)
Mutual labels:  yii2, yii2-extension
Balance
Balance accounting (bookkeeping) system based on debit and credit principle
Stars: ✭ 162 (+350%)
Mutual labels:  yii2, yii2-extension
yii2-newsletter
Module for saving user contacts from newsletter form to database
Stars: ✭ 17 (-52.78%)
Mutual labels:  yii2, yii2-extension
yii2-stat
Yii2 Multi Web Statistic Module (yametrika, google-analytic, own db-counter)
Stars: ✭ 18 (-50%)
Mutual labels:  yii2, yii2-extension
yii2-bankcard-info
银行卡卡号分析(Yii2扩展)
Stars: ✭ 15 (-58.33%)
Mutual labels:  yii2, yii2-extension
behavior-trait
Allows handling events via inline declared methods, which can be added by traits
Stars: ✭ 18 (-50%)
Mutual labels:  yii2, yii2-extension
Yii2 Enhanced Gii
Enhanced Yii2 Gii (generator) that generates related Models & CRUD
Stars: ✭ 183 (+408.33%)
Mutual labels:  yii2, yii2-extension
Yii2 Translate Manager
Translation Manager
Stars: ✭ 221 (+513.89%)
Mutual labels:  yii2, yii2-extension
Crontab
Yii2 extension for crontab support
Stars: ✭ 170 (+372.22%)
Mutual labels:  yii2, yii2-extension
content
Content management system for Yii2
Stars: ✭ 54 (+50%)
Mutual labels:  yii2, yii2-extension
Yii2 Comments
Comments module for Yii2
Stars: ✭ 155 (+330.56%)
Mutual labels:  yii2, yii2-extension
Yii2 Workflow
A simple workflow engine for Yii2
Stars: ✭ 157 (+336.11%)
Mutual labels:  yii2, yii2-extension
yii2-translatable
Translatable behavior aggregates logic of linking translations to the primary model
Stars: ✭ 15 (-58.33%)
Mutual labels:  yii2, yii2-extension
yii2-cashier
Yii2 Cashier provides an interface to Stripe's subscription billing services.
Stars: ✭ 43 (+19.44%)
Mutual labels:  yii2, yii2-extension

Rollbar for Yii2

Packagist Dependency Status Packagist Packagist

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

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require baibaratsky/yii2-rollbar:1.8.*

or add

"baibaratsky/yii2-rollbar": "1.8.*"

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

  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

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

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].