Laravel 11 recently introduced a nice new feature called Context. Both Ignition and Flare have been updated to collect and show all context.
What is Context?
Laravel's latest feature allows you to set some contextual values anywhere in your app. This allows you to store and exchange information across different requests, jobs, and commands in your application. This information is written alongside logs, aiding in understanding the sequence of events leading up to the log entry or error.
use Illuminate\Support\Facades\Context;
Context::add('url', $request->url());
Context::add('trace_id', Str::uuid()->toString());
You can easily retrieve these values anywhere in your app.
use Illuminate\Support\Facades\Context;
Context::all(); // returns all context
Now, this isn’t all that special. With the examples given above, you’d be right to think that Context is just some array-backed cache.
But the special thing that Context does is make all of this information available to any job dispatched in the request where context was set.
dispatch(new MyJob()); // this job will receive the context
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Context;
class MyJob implements ShouldQueue
{
public function handle()
{
// returns the context that was
// set in the request that dispatched
// this job
$allContent = Context::all();
// do some work
// ...
}
}
Context in Ignition and Flare
Ignition, the error page we created and used in Laravel by default, now displays all set context.
Here’s what that looks like in Ignition.

Of course, Flare now collects and displays context as well. Here’s what that looks like when you have an exception in a request or job that holds context.

Continue reading
A minimal "Last used" login option indicator with Alpine.js
Flare's login page now remembers which sign-in option you used last time. Built on Alpine's $persist plugin and just about 25 lines of code.
Alex
How Flare handles Livewire v4's single file components
Single file components are a great addition to Livewire v4, but their compiled output makes debugging harder. Here's how we taught Flare to map hashed file paths and line numbers back to your actual source files.
Ruben
Subscribe to Backtrace, our quarterly Flare newsletter
No spam, just news & product updates