At first glance Kint is just a pretty replacement for var_dump(), print_r() and debug_backtrace().
However, it's much, much more than that. Even the excellent xdebug var_dump improvements don't come close - you will eventually wonder how you developed without it.
Just to list some of the most useful features:
Kint alternatives and similar libraries
Based on the "Debugging and Profiling" category.
Alternatively, view Kint alternatives based on common mentions on social networks and blogs.
8.4 0.0 L1 Kint VS XHProfXHProf is a function-level hierarchical profiler for PHP and has a simple HTML based user interface.
7.3 0.0 L4 Kint VS Tracy😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Kint or a related project?
Kint - debugging helper for PHP developers
What am I looking at?
However, it's much, much more than that. You will eventually wonder how you developed without it.
One of the main goals of Kint is to be zero setup.
Download the file and simply
<?php require 'kint.phar';
Or, if you use Composer:
composer require kint-php/kint --dev
<?php Kint::dump($GLOBALS, $_SERVER); // pass any number of parameters d($GLOBALS, $_SERVER); // or simply use d() as a shorthand Kint::trace(); // Debug backtrace s($GLOBALS); // Basic output mode ~d($GLOBALS); // Text only output mode Kint::$enabled_mode = false; // Disable kint d('Get off my lawn!'); // Debugs no longer have any effect
Tips & Tricks
- Kint is enabled by default, set
Kint::$enabled_mode = false;to turn it completely off.
The best practice is to enable Kint in a development environment only - so even if you accidentally leave a dump in production, no one will know.
- See the buttons on the right of the output? Click them to open a new tab, show the access path for the value, or show a search box.
- There are a couple of real-time modifiers you can use:
~d($var)this call will output in plain text format.
+d($var)will disregard depth level limits and output everything.
Careful, this can hang your browser on large objects!
!d($var)will expand the output automatically.
-d($var)will attempt to
ob_cleanthe previous output and flush after printing.
- You can combine modifiers too:
- Double clicking the + sign will open/close it and all its children.
- Triple clicking the + sign in will open/close everything on the page.
- Add heavy classes to the blacklist to improve performance:
Kint\Parser\BlacklistPlugin::$shallow_blacklist = 'Psr\Container\ContainerInterface';
- To see the output in a docked toolbar at the bottom of the page:
Kint\Renderer\RichRenderer::$folder = true;
- To change display theme, use
Kint\Renderer\RichRenderer::$theme = 'theme.css';. You can pass the absolute path to a CSS file, or use one of the built in themes:
- Kint has keyboard shortcuts! When Kint is visible, press D on the keyboard and you will be able to traverse the tree with arrows, HJKL, and TAB keys - and expand/collapse nodes with SPACE or ENTER.
- You can write plugins and wrapper functions to customize dump behavior!
- Read the full documentation for more information
Licensed under the MIT License
*Note that all licence references and agreements mentioned in the Kint README section above are relevant to that project's source code only.