spatie/ignition
Beautiful, customizable error page for PHP apps. Register in one line to get a rich exception UI with stack traces, code snippets, context, and dark mode. Works standalone; see Laravel Ignition, Symfony bundle, and more integrations.
Installation:
composer require spatie/ignition
For Laravel, use spatie/laravel-ignition instead.
Basic Registration:
Add this to your bootstrap file (e.g., bootstrap/app.php in Laravel):
use Spatie\Ignition\Ignition;
Ignition::make()->register();
First Use Case: Throw an exception in a route/controller:
Route::get('/test-error', function () {
throw new \Exception('Test error for Ignition');
});
Visit /test-error to see the Ignition error page.
Environment-Specific Configuration:
Ignition::make()
->shouldDisplayException(app()->environment('local'))
->register();
Dark Mode:
Ignition::make()
->setTheme('dark')
->register();
Custom Application Path:
Ignition::make()
->applicationPath(base_path())
->register();
Solution Providers: Register custom solutions for exceptions:
Ignition::make()
->addSolutionProviders([
\App\Providers\CustomSolutionProvider::class,
])
->register();
AI-Powered Solutions:
$aiProvider = new \Spatie\Ignition\Solutions\OpenAi\OpenAiSolutionProvider(config('services.openai.key'));
Ignition::make()
->addSolutionProviders([$aiProvider])
->register();
Flare Integration:
Ignition::make()
->runningInProductionEnvironment(app()->environment('production'))
->sendToFlare(config('services.flare.key'))
->configureFlare(function ($flare) {
$flare->context('User', auth()->id());
})
->register();
spatie/laravel-ignition for seamless integration with Laravel’s exception handling.Ignition::fake() in tests to mock error pages.Production Exposure:
if (!app()->environment('production')) {
Ignition::make()->register();
}
Sensitive Data:
censorRequestBodyFields for Flare:
->configureFlare(function ($flare) {
$flare->censorRequestBodyFields(['password', 'api_key']);
})
Performance Overhead:
$aiProvider->useCache(app('cache'), 3600); // Cache for 1 hour
Disable Ignition Temporarily:
Ignition::fake() in tests or override the shouldDisplayException method to bypass Ignition during debugging.Clear Cache:
php artisan view:clear
Check for Conflicts:
App\Exceptions\Handler) are interfering with Ignition’s registration.Custom Solutions:
ProvidesSolution for exceptions or HasSolutionsForThrowable for dynamic solutions.Flare Middleware:
FlareMiddleware:
class LogMiddleware implements \Spatie\FlareClient\FlareMiddleware\FlareMiddleware {
public function handle($report, \Closure $next) {
\Log::error($report->getMessage());
return $next($report);
}
}
UI Customization:
resources/views/vendor/ignition/ for theming.Localization:
php artisan vendor:publish --tag=ignition-translations
How can I help you explore Laravel packages today?