So you’re a PHP developer, huh!? Well then you must be using
print_r. Well I’m going to show you that using them should go in history because there’s new kid in
the block and his name is Kint.
Kint is nothing but a debugging tool for PHP based projects. I have experience in using Kint only in Symfony2 projects.
In Symfony2 projects you just add
"raveren/kint": "1.0.*@dev" to your composer.json and update it.
You don’t have to worry about including Kint in any of the files because composer will autoload it.
To debug a variable you simply write
You’ll get a nice visual representation of your variable. But you might say hey I can do that with
as well. It’s not pretty but I get things done.
Well wrong, have you ever used
var_dump on an object? You’re still waiting for it load?
Kint doesn’t have such problem. Let’s see what happens when you debug an object using Kint.
Kint also comes with nice set of features. If you prepend dd with ! you’ll get already expanded data
Also you don’t have to worry about using
die(); function because your code will automatically be halted
when you use kint with two d’s. If you want to prevent that option you should use only one d. It goes like this
To read more about kint check their official website kint
This post is on GitHub. If you spot any errors please do a pull request.
comments powered by Disqus