In this episode, we tackle error reporting in our PHP project. It's a pretty common thing to bump into errors while building, so it's important to have a neat way to see what went wrong. We start by intentionally causing an error to see what PHP's default error screen looks like — not super helpful or pretty!
To improve this, we introduce the Ignition package, which gives us a much better error page when something goes wrong. It's a popular tool for debugging in Laravel, but works great outside of it too. You'll see how to require the package in using Composer, and get a quick refresher on how packages get added to composer.json
and managed with composer.lock
.
Once Ignition is installed, we walk through how to register it in our bootstrap process (right after the autoloader). You'll literally see the ugly error page turn into a super clear, useful Ignition page with stack traces and more, making it way easier to find and fix bugs as you build.
There's also a bit of chat about not showing these detailed error pages in production (to keep your app secure), and how you can turn off error reporting completely for live environments. All in all, by the end of the episode, you'll be set up to catch and fix errors much more efficiently as you develop your app.