Introducing Breadcrumbs for Laravel

Debug your Laravel applications better with structured event logs.

Some time ago, we introduced breadcrumbs for Ruby and JavaScript. We're pleased to announce that breadcrumbs are now officially supported in our PHP libraries. Here's a quick walkthrough.

How do breadcrumbs help?

A big part of debugging errors is wondering, "How did this happen? Why is this value null?" To help with this, you've probably added extra logs to your app, so you can reference them when something happens.

Log::debug("Processed payment request for $userId");

Log::debug("Sending notification to user $userId on channel $channel");

But logs can be noisy and unstructured. Breadcrumbs let you replace those debug logs with structured event records. No more scouring log files to find out what was going on at 11:20 PM yesterday. Record these events with Honeybadger and you'll see the breadcrumbs right in the error detail on your dashboard.

Recording a breadcrumb is easy. Use the addBreadcrumb() method on the Honeybadger client:

$honeybadger->addBreadcrumb('Sending notification', ['user' => $user->id, 'channel' => $channel]);

// In Laravel
Honeybadger::addBreadcrumb('Sending notification', ['user' => $user->id, 'channel' => $channel]);

If an error occurs later, the breadcrumb will show up in your dashboard:

In our example, the channel is empty — that might be the cause of our error.

Automatic Breadcrumbs in Laravel

Even better, if you're using Laravel, we'll automatically capture breadcrumbs for interesting events. We listen for the following events:

  • Log messages
  • View renders
  • Email dispatches
  • Job dispatches
  • Notification dispatches
  • Database queries
  • Redis commands
  • Incoming requests

All of this can be configured in the config/honeybadger.php config file.

How can you use them?

Breadcrumbs are currently available in our PHP client as of version 2.8.0, and in our Laravel client as of version 3.8.0. You can update your Honeybadger client by running:

composer update honeybadger-io/honeybadger-laravel

or:

composer update honeybadger-io/honeybadger-php

(depending on which you're using.)

Be sure to check out our documentation for more details on using breadcrumbs in PHP.

Let us know how it goes!

We hope that breadcrumbs will be a helpful addition to your debugging toolbox. Try it out, and give us a shout if there is anything you would like to see added.

What to do next:
  1. Try Honeybadger for FREE
    Honeybadger helps you find and fix errors before your users can even report them. Get set up in minutes and check monitoring off your to-do list.
    Start free trial
    Easy 5-minute setup — No credit card required
  2. Get the Honeybadger newsletter
    Each month we share news, best practices, and stories from the DevOps & monitoring community—exclusively for developers like you.
    author photo

    Shalvah Adebayo

    Hi, I'm Shalvah. I'm passionate about making better dev tools, APIs, and documentation.

    Stop wasting time manually checking logs for errors!

    Try the only application health monitoring tool that allows you to track application errors, uptime, and cron jobs in one simple platform.

    • Know when critical errors occur, and which customers are affected.
    • Respond instantly when your systems go down.
    • Improve the health of your systems over time.
    • Fix problems before your customers can report them!

    As developers ourselves, we hated wasting time tracking down errors—so we built the system we always wanted.

    Honeybadger tracks everything you need and nothing you don't, creating one simple solution to keep your application running and error free so you can do what you do best—release new code. Try it free and see for yourself.

    Start free trial
    Simple 5-minute setup — No credit card required

    Learn more

    "We've looked at a lot of error management systems. Honeybadger is head and shoulders above the rest and somehow gets better with every new release."
    — Michael Smith, Cofounder & CTO of YvesBlue

    Honeybadger is trusted by top companies like: