• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Something like laravel "dd" function

I miss something like "dd" function in laravel to print the object's tree and vars.

What is wrong with print_r and var_dump ?


If it is the formatting on screen output try viewing the page source, much cleaner.

I'm sorry, but print_r and var_dump are very simples, in large objects are very tedious debug. Please see that link http://laraveldaily.com/echoing-dd-vs-va...s-print_r/

I'm codeigniter fanatic but we should recognize the good work in another frameworks.


That post seems to be saying that dd is a PITA.

I admit that when debugging very large arrays it is a pain to decipher the content sometimes. But I just do not understand the need for dd at all. I suppose it might be handy in some contexts. It reminds me of exploring objects in a browser console, which I always find a pain. Probably because I do not do it enough.

There is no equivalent of DD in CI. Perhaps you could write one. It does not seem to be a particularly complex function, although I bet it gets complicated when you start taking into account edge cases.

Personally, if you are analysing an array of substantial size to debug something, I would always break code down into smaller chunks which are more manageable.

Quote:we should recognize the good work in another frameworks.

I totally agree with you on this. But I am still failing to see the benefit of dd


If you need something anyway, you may try https://github.com/CesiumComputer/print_d

Or the old CI Favorite as a helper method:

PHP Code:
 * ------------------------------------------------------------------------
 * dDebug Helper
 * Outputs the given variable(s) with formatting and location
 * @access    public
 * @param    mixed    - variables to be output
if ( ! function_exists('dDebug'))
$callee) = debug_backtrace();

$args func_get_args();

$total_args func_num_args();

'<div><fieldset style="background: #fefefe !important; border:1px red solid; padding:15px">';
'<legend style="background:blue; color:white; padding:5px;">'.$callee['file'].' @line: '.$callee['line'].'</legend><pre><code>';

$i 0;

        foreach (
$args as $arg)
'<strong>Debug #' . ++$i ' of ' $total_args '</strong>: ' '<br>';



What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )

If you like the output like dd, you can use http://symfony.com/doc/current/component...umper.html with Composer.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.

(12-10-2016, 04:38 AM)CodeIgnitedX Wrote: I miss something like "dd" function in laravel to print the object's tree and vars.

It's not been maintained since 2007, but I use this little class file



I use FirePHP. Gives me all the debugging data I need, and doesn't stop execution like dd does.

Try this:

Many thanks to CodeIgniter
The 100%  Fastest of all Tested Websites Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.