PHP Kint Debugger

David G - DrupalRecently I was creating a PHP class to help extract fragments of malformed HTML documents. This small project is a work in progress and while using PHPStorm I wanted a simple means to view a nice view of the output of complex PHP variables. I am used to using Drupal’s Devel module to output code to a webpage, and while I’m familiar with debugging tools in PHPStorm I simply wanted a similar tool for barebones PHP script that wasn’t tied to Drupal.

So I found Kint — A modern powerful PHP debugger. Which is available to Drupal’s Devel module as a submodule; which is why I knew this tool existed outside of the Drupalspehere.

Installing and Using Kint

Installing Kint is as dead simple as extracting it to your projects folder and simply requiring the Kint class file to your script:

require './kint/Kint.class.php';

Or if you Composer to manage your projects dependencies you can easily require it and make use of it as found in the example Laravel 4 example integration on StackOverflow.

composer require raveren/kint "dev-master"

After requiring Kint into your project you can then simply call it as needed to debug variable output and stacktraces as need be. I setup PHPStorm to use a local php server to debug my script and simply goto the class I’m working on and view the output from my in-progress code:

Example simple output of Kint values for Arrays, String and NULL values.

Example simple output of Kint values for Arrays, String and NULL values.

Example expanded output of some PHP variables.

Example expanded output of some PHP variables.

As you can see Kint offers a simple, clean useful way to view the state of variables in my code. It also supports mouse and keyboard based navigation if you work that way (which I don’t).

So for me in this small task King was a simple, unobtrusive tool to inject into my budding code to inspect the output of some variables while I debug this script. Yes, PHPStorm can do this too with it’s built-in debugging tools but I’m less comfortable using them at this time.

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , | Posted under Drupal, Programming/Coding | RSS 2.0

Author Spotlight

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at

Leave a Reply

Your email address will not be published. Required fields are marked *