LaraBug

Configuration

After installing LaraBug, you need to configure it to work with your application. The configuration file can be found at config/larabug.php.

Environment Variables

The most important configuration is done through environment variables. Add these to your .env file:

LB_KEY=your-profile-key-here
LB_PROJECT_KEY=your-project-key-here

Getting Your API Keys

  1. LB_KEY - Your profile key that authorizes your account to the API. You can find this in your profile settings at larabug.com
  2. LB_PROJECT_KEY - Your project-specific API key. You receive this when creating a new project in the dashboard

Configuration Options

Environments

By default, LaraBug only reports errors in production environments. You can customize this in config/larabug.php:

'environments' => ['production', 'staging'],

To report errors in all environments:

'environments' => ['*'],

Project Version

Track which version/release of your application generated the exception:

'project_version' => env('APP_VERSION', null),

For Git-based versioning:

'project_version' => trim(exec('git log -1 --pretty="%h" -n1 HEAD')),

Or use the Git hash from your deployment:

'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),

Lines of Code Context

Configure how many lines of code context to include around the exception (max 50):

'lines_count' => 12,

Prevent Duplicate Reports

Set the sleep time between duplicate exceptions to avoid flooding (in seconds):

'sleep' => 60, // 1 minute between duplicate reports

Ignored Exceptions

Specify exception types that should not be reported:

'except' => [
    'Symfony\Component\HttpKernel\Exception\NotFoundHttpException',
    'Illuminate\Auth\AuthenticationException',
    'Illuminate\Validation\ValidationException',
],

Sensitive Data Filtering

Filter out sensitive variables before sending to LaraBug:

'blacklist' => [
    '*authorization*',
    '*password*',
    '*token*',
    '*auth*',
    '*credit_card*',
    '*cvv*',
    '*iban*',
    'cardToken',
],

The blacklist uses wildcard matching, so *password* will filter out any key containing "password".

Custom Server URL

Change the LaraBug API endpoint (useful for self-hosted instances):

'server' => env('LB_SERVER', 'https://www.larabug.com/api/log'),

SSL Verification

Enable or disable SSL certificate verification:

'verify_ssl' => env('LB_VERIFY_SSL', true),

Warning: Never disable SSL verification in production environments!

Complete Configuration Example

<?php

return [
    'login_key' => env('LB_KEY', ''),
    'project_key' => env('LB_PROJECT_KEY', ''),
    
    'environments' => [
        'production',
        'staging',
    ],
    
    'project_version' => env('APP_VERSION', null),
    
    'lines_count' => 12,
    
    'sleep' => 60,
    
    'except' => [
        'Symfony\Component\HttpKernel\Exception\NotFoundHttpException',
        'Illuminate\Auth\AuthenticationException',
    ],
    
    'blacklist' => [
        '*authorization*',
        '*password*',
        '*token*',
        '*auth*',
        '*verification*',
        '*credit_card*',
        '*cvv*',
        '*iban*',
        '*name*',
        '*email*',
    ],
    
    'server' => env('LB_SERVER', 'https://www.larabug.com/api/log'),
    
    'verify_ssl' => env('LB_VERIFY_SSL', true),
];

Testing Configuration

To verify your configuration is working, you can trigger a test exception:

Route::get('/test-larabug', function () {
    throw new Exception('Testing LaraBug integration');
});

Check your LaraBug dashboard to confirm the exception was logged correctly.

Environment-Specific Configuration

Local Development

LB_KEY=your-key
LB_PROJECT_KEY=your-dev-project-key

Staging

LB_KEY=your-key
LB_PROJECT_KEY=your-staging-project-key

Production

LB_KEY=your-key
LB_PROJECT_KEY=your-production-project-key
LB_VERIFY_SSL=true