Lumen Error Tracking

Typical installation time: 5 minutes

Hi there! You've found Honeybadger's guide to Lumen error tracking. Once installed, Honeybadger will automatically report errors wherever they may happen:

  • During a web request
  • In a scheduled command
  • In a background task
  • When a process crashes

On this page:


First, install the honeybadger-laravel package via composer:

composer require honeybadger-io/honeybadger-laravel

...and add the following line to bootstrap/app.php under the "Register Service Providers" section:


Next, add Honeybadger reporting to app/Exceptions/Handler.php:

public function report(Exception $exception)
    if (app()->bound('honeybadger') && $this->shouldReport($exception)) {
        app('honeybadger')->notify($exception, app('request'));


Finally, run the honeybadger:install artisan command:

php artisan honeybadger:install project-api-key

The honeybadger:install command does three things:

  1. Adds HONEYBADGER_API_KEY to .env and .env.example
  2. Creates Honeybadger's config/honeybadger.php configuration file
  3. Sends a test notification to your Honeybadger project

If everything is set up correctly, you should now have an error report in Honeybadger!

Identifying Users

The following middleware will add the user's auth identifier context automatically. This middleware should be applied after any middleware that handles authentication:

// bootstrap/app.php

Adding Context

Context can be added by either the provided Facade or by resolving from the service container.


Honeybadger::context('key', $value);

DI Resolution

use Honeybadger\Honeybadger;

public function __construct(Honeybadger $honeybadger)
    $honeybadger->context('key', $value);

Helper Resolution

use Honeybadger\Honeybadger;

public function __construct()
    app('honeybadger')->context('key', $value);
    app(Honeybadger::class)->context('key', $value)