When it comes to debugging errors in your Laravel applications, Flare already collects several Laravel and user-specific information to send along with the error. However, an additional layer of customization is available that can provide even deeper insights into your application's state when the error or the exception arises: custom context.
Adding custom context
Implementing custom context in Flare is relatively straightforward. You can set context items using the provided Flare facade within your Laravel application in the service provider or an event:
use Spatie\LaravelIgnition\Facades\Flare;
Flare::context('Tenant', 'My-Tenant-Identifier');
Once set, the next time an exception happens, the custom value will be in the error's context tab on the Flare dashboard.
Adding a group of context items
But what if you have multiple items of custom context to include? Flare allows you to group related context items under a common label. Here's how you can create custom context groups:
use Spatie\LaravelIgnition\Facades\Flare;
Flare::group('Custom information', [
'key' => 'value',
'another key' => 'another value',
]);
Adding a glow
While adding context is already very useful, we can take error reporting even further. To understand what happened in your application before each error, it can be helpful to log short statements, also known as glows. Glows would be especially useful to log events that might happen multiple times during the request, for example, when calling a payment provider API.
You can set up glows in your Laravel's service provider:
use Spatie\LaravelIgnition\Facades\Flare;
use Spatie\FlareClient\Enums\MessageLevels;
Flare::glow('This is a message from glow!', MessageLevels::DEBUG, func_get_args());
Once enabled, glows can be found in chronological order in the Debug tab of the error on the Flare dashboard.
Flare already excels at capturing essential data for error diagnosis, but leveraging custom context and glows allows you to debug the errors even better. If that sounds like something you want to explore, you can try Flare for free! New customers get a 10-day trial, and no credit card is required to sign up. Check out our documentation for more information.
Continue reading
Announcing performance monitoring for JavaScript applications
Until now, performance monitoring in Flare was a Laravel and PHP feature. Today we are releasing it for your JavaScript applications too. Monitor page loads, measure Core Web Vitals and profile your React, Svelte or Vue components.
Dries
Why we removed AI solutions from Flare
AI generated solutions are dead, long live AI generated solutions! We removed the old one-shot fixes from a model that could only see the stack trace. It simply couldn't compete with modern agentic AI. In their place, Flare works with the agentic AI tools you already use: an MCP server that handles real triage, a CLI with an agent skill, quick Copy for AI prompts in the UI and docs served as markdown. Hosted agents are in the works too.
Alex
Subscribe to Backtrace, our quarterly Flare newsletter
No spam, just news & product updates