Open utterances-bot opened 2 years ago
Enabling Ignition in public/index.php
seems OK to me (or by creating a custom Runtime when you're using Symfony Runtime).
A tool being registered "at runtime" isn't something that is common in Symfony, as it relies on the compiled container for all features. This makes integrating libraries written using "idiomatic Laravel" often a bit weird to integrate directly in Symfony (e.g. by using Bundle::boot()
like I did in my eloquent bundle).
For ignition, it makes sense to register it as early in the process as possible - so index.php
looks fine.
Hmh, just tried quickly, and indeed on throwing an exception in config/bundles.php
the Ignition error page is shown. But on throwing in eg. src/Controller/DefaultController::indexAction()
I still get the default Symfony error page.
I'm all for ignition in symfony, but this isn't the solution. It would need to be in a bundle that overrides the kernel exception listener, or else as lucasballyn observed you'll still get the default symfony errors. Plus, the solution would have to pay attention to APP_ENV to prevent verbose error pages in prod environments.
I may make this bundle myself if someone doesn't beat me to the punch.
@amacrobert-meq If you decide on creating a bundle, you could consider making the official one.
I've prepped a repo where you could send a PR to (or I could just give you edit rights) https://github.com/spatie/symfony-ignition-bundle
Of course, don't feel yourself obligated in any way.
A better error page for Symfony applications - Freek Van der Herten's blog on PHP, Laravel and JavaScript
https://freek.dev/2169-a-better-error-page-for-symfony-applications