← Back to archive

Repo of the Day

spatie/ignition

Published: Oct 13, 2024

Open repository ↗

A beautiful error page for PHP apps

Summary

Ignition is a PHP package from Spatie that renders a customizable in-browser error page when an exception is thrown in a PHP application. It bundles built-in solution hints, optional OpenAI-generated suggestions, and integration with the Flare error-tracking service.

What it is useful for

Ignition replaces default PHP error output with a structured page that shows the exception class, message, and stack trace in a readable layout, which speeds up local debugging. It is especially handy in plain PHP projects where richer error tooling is less common than in frameworks like Laravel.

Beyond local display, Ignition standardizes production error reporting through Flare. You can attach custom key-value context, anonymize user IP addresses, and censor sensitive request body fields such as password (replaced with <CENSORED>). Ignition can also surface "solutions" next to exceptions: the README states that common cases like bad method calls or undefined properties are covered out of the box, and you can implement ProvidesSolution or HasSolutionsForThrowable to ship your own fix instructions.

An optional OpenAI integration can attempt to suggest a fix. The README documents that the provider sends the error message, class, stack frame, and small context, but explicitly does not send request payloads or environment variables. It also warns that AI suggestions "may not be 100% correct for your context," so they should be treated as hints.

A documented limitation: Ignition should not render in production, because the page can leak sensitive information. Use shouldDisplayException(false) or runningInProductionEnvironment(true) to suppress it.

How engineers can use it

For Laravel, Symfony, Drupal 10+, and OpenMage, the README directs users to framework-specific packages (spatie/laravel-ignition, spatie/symfony-ignition-bundle, plus the Drupal and OpenMage modules). For other PHP projects:

composer require spatie/ignition

Then register it during bootstrap:

\Spatie\Ignition\Ignition::make()->register();

Configuration methods documented in the README:

  • applicationPath($basePath) to trim your project path from stack frames
  • setTheme('dark') to switch to dark mode
  • addSolutionProviders([...]) to register custom solutions
  • sendToFlare($apiKey) plus configureFlare(...) to forward exceptions, attach context, anonymize IP, or censor request fields

To enable OpenAI suggestions, also install openai-php/client and pass an API key into OpenAiSolutionProvider before adding it to addSolutionProviders.