spatie/laravel-ignition
Beautiful, customizable error page for Laravel apps (Laravel 10+ / PHP 8.1+). Ignition improves exception debugging with context and solutions, and can share errors to Flare for production tracking and notifications via an API key.
Installation:
composer require spatie/laravel-ignition
Ignition auto-registers via Laravel's service provider system—no manual configuration is required for basic usage.
First Use Case:
Trigger an error in your application (e.g., 1/0 in a route or controller). Ignition replaces Laravel’s default error page with an interactive, detailed error screen featuring:
use statement?").Where to Look First:
http://your-app.test/ignition for local testing).config/ignition.php (customize solutions, AI keys, or Flare integration).Local Development:
dd() or var_dump() for complex debugging. Use the "Copy Exception" button to share errors with teammates.use statements, route definitions)..env variables (redacted by default).Production Monitoring (Flare Integration):
.env:
FLARE_API_KEY=your_key_here
php artisan flare:test-error to verify setup.Customizing Solutions:
// app/Providers/IgnitionServiceProvider.php
use Spatie\Ignition\Solutions\Solution;
public function register()
{
Solution::extend('custom_solution', function () {
return Solution::create('Custom Solution')
->setDescription('Add this to your config file:')
->setSolution('<code>...</code>');
});
}
Artisan Commands:
php artisan ignition:clear
php artisan flare:share
Testing:
use Spatie\Ignition\Ignition;
public function testErrorPage()
{
Ignition::fake(); // Disable Ignition for the test
// ... test code ...
}
With Livewire:
.blade.php files.With Queues:
With API Testing:
With Homestead/Sail:
sail commands and suggests fixes (e.g., sail artisan migrate).With IDEs:
Flare API Key Leaks:
FLARE_API_KEY to version control..env to .gitignore and use Laravel’s .env.example for templates.Sensitive Data Exposure:
ignition.php to redact sensitive keys:
'redact' => [
'password',
'api_token',
'secret_*',
],
Performance Impact:
'enabled' => env('APP_ENV') !== 'production',
Middleware Conflicts:
app/Http/Kernel.php:
protected $middleware = [
// ...
\Spatie\Ignition\Middleware\Ignition::class,
];
Livewire 4+ Support:
composer require laravel/livewire:"^4.0"
Disable Ignition Temporarily:
IGNITION_ENABLED=false in .env to bypass Ignition for testing.Log Leakage:
laravel.log, ensure you’re using Ignition v1.7.1+ (fixed in #224).Custom Exception Handling:
Ignition::ignore(function (Throwable $e) {
return $e instanceof CustomException;
});
Symfony 8/Laravel 13:
Request::get()).AI Solutions:
OPENAI_API_KEY in .env). Disable with:
'ai' => [
'enabled' => false,
],
Custom Context:
use Spatie\Ignition\Context\Context;
Context::capture(function () {
return [
'user_id' => auth()->id(),
'custom_metric' => app()->get('custom.metric'),
];
});
Override Views:
php artisan vendor:publish --tag=ignition-views
resources/views/vendor/ignition/.Solutions Providers:
Solution::extend('laravel-shift', function () {
return Solution::create('Laravel Shift')
->setDescription('Check Laravel Shift for migrations:')
->setSolution('https://laravel-shift.com');
});
Flare Middleware:
use Spatie\FlareClient\Flare;
Flare::extend(function ($report) {
$report->addContext('custom', ['key' => 'value']);
});
Testing Ignition:
Ignition::fake() in tests to simulate errors without triggering the UI:
$this->expectException(DivisionByZeroError::class);
Ignition::fake();
1 / 0;
How can I help you explore Laravel packages today?