PHP code example of biller / yii2-phpbrake

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

    

biller / yii2-phpbrake example snippets


return [
    // ...
    'components' => [
        // ...
        'airbrakeService' => [
            'class' => biller\phpbrake\AirbrakeService::class,

            'enabled' => true, // default TRUE

            'projectId' => 'YOUR_PROJECT_ID',
            'projectKey' => 'YOUR_PROJECT_KEY',

            'environment' => YII_ENV, // default NULL
            'appVersion' => [your-app-version], // default NULL
            'rootDirectory' => [source-root-directory], // default NULL
            'host' => [api-endpoint-host], // default "api.airbrake.io"
            'httpClient' => [http-client-type], // default "default"

            'setGlobalInstance' => [boolean], // default TRUE
            'setErrorHandler' => [boolean], // default FALSE

            'filters' => [ // default NULL
                // 'PHPSESSID' and '_csrf' parameters should not be transferred to airbrake
                [
                    'class' => biller\phpbrake\ParamsFilter::class,
                    'params' => ['PHPSESSID', '_csrf'],
                ],
            ],
        ],
    ],
];

return [
    'components' => [
        'log' => [
            'targets' => [
                [
                    'class' => biller\phpbrake\AirbrakeTarget::class,
                    'levels' => ['error'],
                ],
            ],
        ],
    ],
];