PHP code example of elzix / yii2-sentry

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

    

elzix / yii2-sentry example snippets




return [
  'id' => 'my-app',

  'bootstrap' => [
    'sentry',
    'log',
  ],

  'components' => [
    'sentry' => [
      'class' => elzix\Yii2\Sentry\Component::class,
      'dsn' => 'https://[email protected]/0000000',
    ],

    'log' => [
      'targets' => [
        [
          'class' => elzix\Yii2\Sentry\LogTarget::class,
          'levels' => ['error', 'warning'],
          'except' => [
            'yii\web\HttpException:40*',
          ],
        ],
      ],
    ],
  ],
];



[
  'class' => elzix\Yii2\Sentry\Component::class,
  'dsn' => 'https://abcdefghijklmnopqrstuvwxyz123456:[email protected]/0000000',
  'integrations' => [
    [
      'class' => elzix\Yii2\Sentry\Integration::class,
      // Headers that should not be send to Sentry at all
      'stripHeaders' => ['cookie', 'set-cookie'],
      // Headers which values should be filtered before sending to Sentry
      'piiHeaders' => ['custom-token-header', 'authorization'],
      // Body fields which values should be filtered before sending to Sentry
      'piiBodyFields' => [
        'controller/action' => [
          'field_1' => [
            'field_2',
          ],
          'field_2',
        ],
        'account/login' => [
          'email',
          'password',
        ],
      ],
      // Text to replace PII values with
      'piiReplaceText' => '[Filtered PII]',
    ],
    Sentry\Integration\ErrorListenerIntegration::class,
  ],
]