xinningsu/yii2-raygun

Raygun Yii2 logger, Raygun integration for Yii2.

v1.0.0 2025-08-21 08:07 UTC

This package is not auto-updated.

Last update: 2025-08-22 07:47:37 UTC


README

Raygun integration for Yii2, Raygun Error Logger.

MIT licensed Build Status Code Coverage Scrutinizer Code Quality Code Intelligence Status

Installation

composer require xinningsu/yii2-raygun

Usage

Once you have finished the Raygun installation, set up Raygun component and Raygun log target in Yii common config file, e.g., config/web.php:

[
    // ...
    'components' => [
        // ...
        'raygun' => [
            'class' => \Sulao\YiiRaygun\RaygunComponent::class,
            'config' => [
                'api_key' => 'your_raygun_api_key', // Update with your Raygun API key
                // For more configuration options, please refer to 
                // https://github.com/xinningsu/yii2-raygun/blob/master/config/raygun.php
            ],
        ],
        'log' => [
            // ...
            'targets' => [
                // ...
                [
                    'class' => \Sulao\YiiRaygun\RaygunTarget::class,
                    'levels' => ['error', 'warning'],
                    'except' => [
                        \yii\web\HttpException::class,
                    ],
                ],
            ],
        ],
        // ...
    ],
    // ...
],

Testing

In the controller file, add the code below

\Yii::error('test error');;

Or trigger an exception

throw new \Exception('test exception');

Then, check if the report is available in the Raygun Crash Reporting.

License

MIT