Kint PHP Debugger

Plugin Banner

Kint PHP Debugger

by Tonya Mork

Download
Description

This WordPress plugin is a wrapper for the Kint PHP Debugger utility version 1.x. Now instead of using var_dump() or print_r(), you simply use d() with zero, nadda, no formatting required.

Use this tool when you are debugging your website, in place of var_dump(), print_r() and debug_backtrace().

Handy Tools

Some handy tools just for the PHP Developer:

  • d( $var ); to render a collapsible UI container which displays your variable data in “the most informative way”
  • ddd( $var ); same as d() except that it also executes die() to halt execution.

Here are some variations of d() to give you the display you want:

  • ~d( $var ); outputs in plain text format.
  • +d( $var ); disregards depth level limits and outputs everything
  • !d( $var ); shows expanded rich output
  • -d( $var ); attempts to ob_clean() the previous output (dump something inside of HTML)

Profiler

Kint even includes a naïve profiler, which can help you analyze which blocks of code take longer than others:

Kint::dump( microtime() ); // just pass microtime()
sleep( 1 );
Kint::dump( microtime(), 'after sleep(1)' );
sleep( 2 );
ddd( microtime(), 'final call, after sleep(2)' );

See screenshot 2 for what is rendered out in your browser.

Admin Bar

“KINT ACTIVE” indicator displays in the WordPress admin bar to alert you when the plugin is active.

From your WordPress dashboard

  1. Visit ‘Plugins > Add New’
  2. Search for ‘Kint PHP Debugger’
  3. Activate Kint PHP Debugger from your Plugins page.

Once Activated

Whenever you want to dump out the data within a variable, simply use d( $var ) to replace when you do pre + var_dump().

To dump and die, you use ddd( $var );.

  1. An example of what gets rendered in the browser when using 'd( $var )'.

    An example of what gets rendered in the browser when using 'd( $var )'.

  2. Profile example from Kint.

    Profile example from Kint.

  3. "KINT ACTIVE" indicator in the WordPress admin bar.

    "KINT ACTIVE" indicator in the WordPress admin bar.

How do I use this utility?

When you are testing your code, you use d( $var ) in place of var_dump( $var ) and print_r( $var ). No need to wrap it in pre’s either.

What does it render in the browser?

Kint provides a handy UI that wraps up the data within the variable. Click to open it up and see the data.

See the screenshot 1 for an example.

What else does Kint provide to help me debug?

As you can see the screenshot 1, besides the handy UI, it also provides you with a full call stack. Click on the text below the UI to expand it out.

Can I run this on a live site?

I wouldn’t unless you are testing. This tool is for debug only. Once you push the site live, deactivate and delete this plugin.

What should I do when the site goes live?

Deactivate and delete this plugin.

Very fine

By Adriano G. V. Esposito (Adriano Esposito) on February 11, 2020

Very fine

Great PHP Debugger

By Rita Best (rbest) on May 7, 2019

The Best! I keep coming back again and again. Kint makes WordPress (PHP) development/debugging a breeze. Save yourself time & frustration install this plugin.

Useful tool

By Mahd Ali (mahd) on March 21, 2019

It is a very useful tool but some people prefer a video how to use to use a tool. Its awesome thanks

Works great!

By Chris Dillon (cdillon27) on September 15, 2016

Thanks for this plugin. It makes debugging my arrays of arrays of arrays much simpler. 😉

Useful

By Pär Thernström (eskapism) on September 3, 2016

Really like to debug with Kint, and this plugin makes it much easier.

Indispensable plugin

By Rose (rosecox) on September 3, 2016

Love this plugin, saves hours of time in development.

Does what it says

By John Dorner (jdorner) on February 11, 2021

Saves a lot of time when writing plugins and themes. Thanks! Update 2/11/2021 - even though this plugin hasn't had any updated in more than 2 years, it is still working just great.

Improves Workflow and Troubleshooting

By Anonymous User 7698158 (anonymized_7698158) on September 3, 2016

Love this plugin. Displays more than var_dump does and is so much easier to read the output. Handy toggle to display more information is very helpful. Love that ddd() option to display and stop execution. Thank you!!!

Best PHP debugger!!!

By Caio (umagrama) on September 3, 2016

I love this tool! I used it in many different platforms and is great for debuging PHP... I don't know how one could code without it. Thanks!

Version 2.0.2

  • Bump to sync versions.

Version 2.0.1

  • Removed changing the admin color palette to coffee.
  • Removed changing the admin bar background color.

Version 2.0.0

  • Updated Kint version.
  • Tested against WP 5.1

Version 1.2.1

  • Added “KINT ACTIVE” indicator to the WordPress admin bar to alert the plugin is activated.

Version 1.2.0

  • Excluded Composer files.
  • Tested with WordPress 5.1.

Version 1.1.0 to 1.1.4

  • Changed to the kint-php package
  • Upgraded Kint to v1.1

Version 1.0.1

  • Upgraded Kint to v1.0.10

Version 1.0.0

  • First release
Back to top