Boost Your Laravel Debugging: Say Goodbye to dd() with LaraDumps

June 14, 2023ยท5 min read
Boost Your Laravel Debugging: Say Goodbye to dd() with LaraDumps - codementor.tech

Are you a Laravel developer struggling with debugging your code? We understand the challenges that come with traditional methods like using the dd() function. Fortunately, we have a better solution for you! Introducing LaraDumps, a powerful and free tool specifically designed to enhance your Laravel coding and debugging experience.

In the past, using dd() may have provided quick results, but it came with limitations. The script execution would halt, making it inconvenient to obtain the desired information. Additionally, when working with Laravel model instances, the debugging process became even more cumbersome.

With LaraDumps, you can now say goodbye to these frustrations. This tool offers a beautiful interface that provides precise information without interrupting the response. Let's delve into how you can leverage LaraDumps to streamline your debugging workflow.

Installation is a breeze. Begin by downloading the LaraDumps desktop application. Then, add the LaraDumps Laravel package to your project. Once you've completed these steps, you're ready to embark on an effortless debugging journey.

So what is this tool?

LaraDumps is a friendly app that boosts your Laravel PHP coding and debugging experience.

How do we install it?

  • Download the LaraDump desktop application.
  • Add the LaraDump Laravel package to your laravel project.
  • Start debugging!

Desktop app

Laravel Package

  • Install LaraDump Package in your laravel project using Composer.

  • Run the command:

Usage
composer require laradumps/laradumps --dev
  • Now, configure LaraDumps. Run the command below:
Usage
php artisan ds:init
  • The wizard will guide you through the configuration options.

  • just note that I am using docker so when I asked about the app host address I choose the host.docker.internal otherwise you should use the app address using 1,3 or other if your using another address.

  • Using LaraDumps is simple. Instead of using dd() or dump(), employ the ds() function. Unlike dd(), the application will continue functioning while delivering results to the desktop app. It's a win-win situation!

Let's explore some of the powerful debugging features LaraDumps offers:

Debugging Models:

Usage
ds()->model(User::first());

Debugging SQL Queries:

Usage
ds()->queriesOn();
User::query()->where('id', 20)->get();
ds()->queriesOff();
User::query()->where('id', 20)->ds()->get();

Viewing Data in a Table:

Usage
$users = User::query()->select(['id', 'name', 'email'])->limit(5)->get();
ds()->table($users, 'users table');

Measuring Execution Time:

Usage
ds()->time('counter');
for($i=0; $i<100000; $i++) {
// Some code
}
ds()->stopTime('counter');

Debugging HTTP Requests:

Usage
ds()->httpRequest('GET', 'https://api.example.com/users');

Debugging Mailables:

Usage
$mailable = new WelcomeEmail($user);
ds()->mailable($mailable);

Debugging Artisan Commands:

Usage
ds()->artisanCommand('migrate');

Debugging Jobs:

Usage
ds()->job(MyJob::class);

Debugging Collections:

Usage
$collection = collect([1, 2, 3]);
ds()->collection($collection, 'my_collection');

Debugging JSON:

Usage
$json = '{"name": "Chirag", "age": 30}';
ds()->json($json);

These are just a few examples of what you can achieve with LaraDumps. It also supports debugging HTTP requests, Mailables, Artisan commands, Jobs, Cache, Collections, Routes, Strings, JSON, and much more.

Worried about accidentally pushing debugging code to your Git repository? LaraDumps has you covered with an artisan command that detects any lingering ds() instances in your codebase. It's a great safety net for seamless development.

For visual enhancement, you can add labels, utilize multiple screens, and apply colors to your debugging process. The customization options are abundant, allowing you to organize and differentiate your debugging variables effectively.

If you prefer not to invoke the desktop app automatically, you can disable this behavior in the .env file. You can also send Quiet Dumps to avoid app invocation entirely.

For more detailed instructions and additional features, make sure to consult the comprehensive documentation provided by LaraDumps.

In conclusion, we have presented LaraDumps as a superior alternative to traditional Laravel debugging methods. By utilizing this free tool, you can overcome the limitations of dd() and streamline your debugging workflow. We hope that this article has shed light on how LaraDumps can help you debug your Laravel code with ease and efficiency.

If you have any questions or need further assistance in using LaraDumps, please feel free to leave a comment below. We're here to support you on your Laravel debugging journey.

Thank you for reading, and happy debugging with LaraDumps!

Happy Coding! Happy Debugging!

Go back Home.