PHP code example of dmftaras / yii2-sentry

1. Go to this page and download the library: Download dmftaras/yii2-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/ */

    

dmftaras / yii2-sentry example snippets


    'components' => [
        'sentry' => [
            'class' => 'dmftaras\sentry\Component',
            'dsn' => 'YOUR-PRIVATE-DSN', // private DSN
            'environment' => 'staging', // if not set, the default is `production`
            'release' => '1.0' // release version
        ],
        'log' => [
            'targets' => [
                [
                    'class' => 'dmftaras\sentry\Target',
                    'levels' => ['error', 'warning'],
                    'except' => [
                        'yii\web\HttpException:404',
                    ],
                ],
            ],
        ],
    ],

    'components' => [
        'sentry' => [
            'enabled' => false,
        ],
    ],

try {
    throw new \Exception('fatal error');
} catch (\Exception $e) {
    \Yii::$app->sentry->captureException($e);
}

\Yii::$app->sentry->captureMessage('test msg');

php composer.phar