Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
/ yii-sentry Public archive

The Yii Sentry extension that allows developers to push messages and logs to the Sentry service or your own Sentry server

License

Notifications You must be signed in to change notification settings

zero-archive/yii-sentry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YiiSentry

Latest Stable Version License

YiiSentry is an extension for the Yii PHP framework that allows developers to push messages and logs to the Sentry service or your own Sentry server.

Requirements:

Install

Via composer:

$ composer require dotzero/yii-sentry
  • Add vendor path to your configuration file, attach component and set properties:
'aliases' => array(
    ...
    'vendor' => realpath(__DIR__ . '/../../vendor'),
),
'components' => array(
    ...
    'sentry' => array(
        'class' => 'vendor.dotzero.yii-sentry.ESentry',
        'sentryDir' => 'vendor.sentry.sentry', // Path alias of the sentry-php directory (optional)
        'enabled' => true, // Enabled or disabled extension (optional)
        'dsn' => '[YOUR_DSN_FROM_SENTRY_SERVER]',
        // Raven PHP options (https://github.com/getsentry/sentry-php#configuration)
        'options' => array(
            'site' => 'example.com',
            'tags' => array(
                'php_version' => phpversion(),
            ),
        ),
    ),
),
  • Add the following to your config file log section to enable ESentryLogRoute:
'routes' => array(
    ...
    array(
        'class' => 'vendor.dotzero.yii-sentry.ESentryLogRoute',
        'levels' => 'error, warning',
    ),
),

Usage:

// To capture Message
$sentry = Yii::app()->sentry;
$sentry->captureMessage('test', array(
    'param1' => 'value1',
    'param2' => 'value2',
));

// To capture Exception
try {
    throw new Exception('Error Processing Request', 1);
} catch (Exception $e) {
    $sentry = Yii::app()->sentry;
    $sentry->captureException($e);
}

License

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

About

The Yii Sentry extension that allows developers to push messages and logs to the Sentry service or your own Sentry server

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages