Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my debug data unformatted?

var_dump and print_r are displayed are not formatted when using Laravel 4. How do I format the data to be more readable?

like image 911
krissanawat Avatar asked Dec 02 '22 19:12

krissanawat


2 Answers

Add Kint to your composer.json by running this on the command line:

composer require raveren/kint "dev-master"

And then try it:

dd( new Controller );

You should see this:

enter image description here

Better, huh?

like image 58
Antonio Carlos Ribeiro Avatar answered Dec 23 '22 12:12

Antonio Carlos Ribeiro


Use kint

we use should s() instead of print_r()

use should d() instead of var_dump()

ex: sd($arr); like same print_r($arr); die();

Ref: http://raveren.github.io/kint/#configuration

like image 36
Krucamper Avatar answered Dec 23 '22 12:12

Krucamper