Lumen Exception & Error Tracking

Typical installation time: 5 minutes

Hi there! You’ve found Honeybadger’s guide to Lumen error and exception 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!

Note: The default config for Lumen won’t report errors to Honeybadger on local and testing environments. You can change that with the [report_data option] (../guides/reducing-noise.html).

Identifying Users

Honeybadger automatically captures details about the current logged-in user, as well as the controller and method name. No extra configuration needed. We only capture the user ID, so no sensitive information is transmitted.

When an error occurs, you’ll see an Affected Users section on your dashboard, where we’ll list the user IDs and how many times they encountered the error.

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)