spatie/symfony-ignition-bundle
Replace Symfony’s default exception page with Spatie Ignition: a beautiful, customizable error screen with context, stack traces, dark mode, and helpful debugging tools. Install as a dev bundle and configure via ignition.yaml to fit your app.
Installation:
composer require spatie/symfony-ignition-bundle
Add the bundle to config/bundles.php:
return [
// ...
Spatie\SymfonyIgnition\SymfonyIgnitionBundle::class => ['all' => true],
];
First Use Case:
Trigger an error (e.g., throw new \Exception('Test error');) and visit the page in your browser. Ignition will replace Symfony’s default error page with a rich, interactive UI.
Key Files:
config/packages/spatie_symfony_ignition.yaml (default config).public/ignition (static assets; avoid modifying unless extending).Debugging Exceptions:
Environment-Specific Behavior:
ignition.enabled: false in .env or config.IGNITION_LEVEL=local to restrict visibility to specific environments.Integration with Laravel:
App\Exceptions\Handler). Ignition will render Laravel’s formatted exceptions.spatie/laravel-ignition (if using Laravel) for tighter integration.Custom Error Pages:
php bin/console assets:install public
templates/ignition/error.html.twig (Symfony) or resources/views/vendor/ignition/error.blade.php (Laravel).API Errors:
ignition.json_errors: true to render API errors in the UI.Collaboration Features:
Performance Overhead:
ignition.enabled: false).ignition.ignore_routes to exclude specific routes (e.g., API endpoints).Caching Issues:
php bin/console cache:clear
?v=1.0) if needed.Symfony-Specific Quirks:
debug: true in .env for full Ignition functionality.Laravel-Specific Notes:
spatie/laravel-ignition for Laravel-specific features (e.g., route list integration).render() method details by default. Use ignition.show_laravel_exceptions: true in config.Dark Mode:
Log Inspection:
var/log/dev.log for Ignition-related errors (e.g., missing files or config issues).Disable Ignition Temporarily:
IGNITION_LEVEL=none in .env to revert to Symfony’s default error pages for troubleshooting.Custom Exception Handling:
ExceptionListener interface. If exceptions aren’t captured, verify your listener is registered.Asset Loading:
public/ignition directory exists and permissions are correct (chmod -R 755 public/ignition).Custom Error Data:
Ignition::share() in your ExceptionListener:
use Spatie\SymfonyIgnition\Ignition;
public function onKernelException(GetResponseForExceptionEvent $event) {
Ignition::share('user_id', auth()->id());
}
Event Listeners:
// config/services.yaml
Spatie\SymfonyIgnition\Event\IgnitionEvents::ERROR_VIEW_CREATED:
listener: App\Listener\CustomErrorListener
Theming:
public/ignition/scss/_variables.scss for global styling changes.Route Filtering:
# config/packages/spatie_symfony_ignition.yaml
ignition:
ignore_routes:
- ^/api/
- ^/healthcheck
How can I help you explore Laravel packages today?