PHP code example of afterbug / afterbug-yii

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

    

afterbug / afterbug-yii example snippets


$config = [
    // ...
    'components' => [
        'afterbug' => [
            'class' => 'AfterBug\AfterBugYii\AfterBug',
            'apiKey' => 'YOUR_AFTERBUG_API_KEY',
        ],
        // ...
        'errorHandler' => [
            'class' => 'AfterBug\AfterBugYii\Exceptions\ErrorHandler',
            'errorAction' => 'site/error',
        ],
    ]
];

$config = [
    // ...
    'components' => [
        'afterbug' => [
            'class' => 'AfterBug\AfterBugYii\AfterBug',
            'apiKey' => 'YOUR_AFTERBUG_API_KEY',
            'excludeExceptions' => ['yii\web\NotFoundHttpException']
        ],
    ]
];

$config = [
    // ...
    'components' => [
        'afterbug' => [
            'class' => 'AfterBug\AfterBugYii\AfterBug',
            'apiKey' => 'YOUR_AFTERBUG_API_KEY',
            'on beforeNotify' => function ($event) {
                $event->client->setMetaData([
                    'custom' => 'Your custom data',
                ]);
            }
        ],
    ]
];