var_dump
and print_r
are displayed are not formatted when using Laravel 4. How do I format the data to be more readable?
Asked
Active
Viewed 7,052 times
4

Jake Wilson
- 88,616
- 93
- 252
- 370

krissanawat
- 616
- 1
- 11
- 36
-
I guess you have already looked in http://doc.laravelbook.com/errors/ ? – mzedeler Jun 09 '13 at 12:15
-
4Install xdebug. Everything will be pretty then. – Jason Lewis Jun 09 '13 at 12:35
3 Answers
15
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:
Better, huh?

microspino
- 7,693
- 3
- 48
- 49

Antonio Carlos Ribeiro
- 86,191
- 22
- 213
- 204
-
1Nothing, just that. Are you having trouble? There's a known tiny issue between it and Laravel 4, but not too difficult to fix: https://github.com/laravel/framework/issues/1472. – Antonio Carlos Ribeiro Jun 10 '13 at 02:13
-
I'm a real noob at composer, I have a small request, could you re-edit your question to include the stable branch of kint, as I refer to your answer from the documentation of kint: http://raveren.github.io/kint/#integration Thanks a lot! – raveren Oct 08 '13 at 16:05
-
Using dd() in the current version of laravel (4.0.10) has no effect. Probably because dd() is built into laravel now. Using d() applied Kint properly. – Landjea Dec 09 '13 at 14:47
-
This is a Laravel problem. It should not create a dd() if there's already one around. Unfortunately this was already discussed in a Laravel issue but the most we got from developers was: delete your vendors and composer install again, sometimes it works. – Antonio Carlos Ribeiro Dec 09 '13 at 15:00
-
2Is there a way to disable Kint in Laravel for production environments? – Kyle Ridolfo Feb 08 '14 at 22:24
2
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();

Krucamper
- 371
- 3
- 5
1
You can use the pre tag to format align your answear http://www.w3schools.com/tags/tag_pre.asp

someone44
- 59
- 1
- 7