PHP code example of dotzero / yii-sentry
1. Go to this page and download the library: Download dotzero/yii-sentry library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dotzero / yii-sentry example snippets
'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(),
),
),
),
),
'routes' => array(
...
array(
'class' => 'vendor.dotzero.yii-sentry.ESentryLogRoute',
'levels' => 'error, warning',
),
),
// 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);
}