Laravel Packages

Package Pages

There are multiple ways to debug your laravel applications. This tutorial will show you various solutions and the benefits of each. Starting off with the easiest!

Debugging with dd()

dd stands for Dump and Die which means dump whatever you pass into the dd function and stop all script execution after this. You would use it like this:

dd(Auth::user());

This outputs your currently authenticated user model. Laravel even gives it nice formatting for free!

Dump without die

If you want to continue rendering the page you can use the dump method as that does not stop executing the script. You would use it like this:

dump(Auth::user());

Laravel debug bar

We love packages here at package pages and we love to shout out a fellow package creator @barryvdh. The laravel debug bar is one of the standard ways to debug a laravel application.

Use it like this:

composer require barryvdh/laravel-debugbar --dev

After that, you should (once you reload your browser window) see a new bar at the bottom of the screen. Open it up and see all the new information you have. For us, the "Queries" tab is great as it shows the direct queries made to the database. This way you can see if any queries are slowing your page load down.