Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

kint

Kint - a powerful and modern PHP debugging tool.

Subscribe to updates I use kint


Statistics on kint

Number of watchers on Github 2066
Number of open issues 5
Average time to close an issue 17 days
Main language PHP
Average time to merge a PR 1 day
Open pull requests 16+
Closed pull requests 27+
Last commit almost 2 years ago
Repo Created over 7 years ago
Repo Last Updated over 1 year ago
Size 5.14 MB
Homepage http://kint-php.g...
Organization / Authorkint-php
Latest Release2.2
Contributors16
Page Updated
Do you use kint? Leave a review!
View open issues (5)
View kint activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating kint for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Kint - debugging helper for PHP developers

Screenshot

What am I looking at?

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:

Installation

One of the main goals of Kint is to be zero setup.

Download the file and simply

<?php

require 'kint.php';

Or, if you use Composer:

composer require kint-php/kint

Usage

<?php

Kint::dump($GLOBALS, $_SERVER); // pass any number of parameters
d($GLOBALS, $_SERVER); // or simply use d() as a shorthand

Kint::trace(); // Debug backtrace
d(1); // Debug backtrace shorthand

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 its functionality completely off. The best practice is to enable Kint in a development environment only (or for example Kint::$enabled_mode = ($_SERVER['REMOTE_ADDR'] === '<your IP>');) - so even if you accidentally leave a dump in production, no one will know.
  • 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.
  • Clicking the + sign or the bar will open/close it.
  • Double clicking the + sign will open/close it and all its children.
  • Triple clicking the + sign in will open/close everything on the page.
  • See the tiny arrows on the right of the output? Click them to open the node in a separate tab, or to show the access path for the value.
  • 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_clean the previous output.
    • You can combine modifiers too: ~+d($var)
  • To change display theme, use Kint_Renderer_Rich::$theme = '<theme name>'; where available options are: 'original.css' (default), 'solarized.css', 'solarized-dark.css' and 'aante-light.css'. You can also pass the absolute path to a CSS file to use that instead.
  • dd(), sd(), and ddd() were removed in Kint 2, but you can make them yourself with helper aliases
  • Read the full documentation for more information

Authors

Jonathan Vollebregt (jnvsor)
Rokas leinius (raveren)

License

Licensed under the MIT License

kint open issues Ask a question     (View All Issues)
  • almost 3 years Output array as table
  • almost 3 years $tabularData on examples/overview.php
  • almost 3 years javascript: noden
  • almost 3 years Problem with PDOStatement and consuming objects
  • about 3 years kint::debug to use a different encoding when in CLI
  • about 3 years RFC: Major version bump - Kint 2.0-dev
  • over 3 years Better recursion to non-direct precedents handling
  • over 3 years Make collapse/expand all/parent only more discoverable
  • over 3 years Filter trace
  • over 3 years Pods framework objects basically dead lock the kint output
  • over 3 years Exclude dumping of objects of specific class
  • almost 4 years Documentation: New (easy) instructions for CodeIgniter-Kint-Integration
  • almost 4 years Show access path on double click
  • about 4 years Character encoding problem
  • about 4 years add support for Symfony 2.7
  • about 4 years Concrete5 Kint plugin
  • about 4 years WordPress kint plugin
  • about 5 years The '-' modifier should not clean previous Kint outputs
  • over 5 years Doc about how to install Kint globally on PHP
  • over 5 years Allow to use custom parsers from outside Kint folders
  • almost 6 years Kint for Laravel with Twig templates
  • almost 6 years Add adminer-style compiler to single file
  • almost 6 years Research better config.php & custom parser support for composer users
  • almost 6 years Rethink class definition display
  • almost 6 years Create a page where a user can customize & download config.php
  • over 6 years Impresspages plugin
  • over 6 years create option to output everything only after script execution ends
  • almost 7 years feature request: add keyboard shortcut to expand all nodes
  • almost 7 years Link to online documentation on inbuilt functions in trace & variable name output
  • almost 7 years create a test suite that could act as a feature demo
kint open pull requests (View All Pulls)
  • Fixed cliDetection
  • Add mode to delay output until end of script
  • Display access path along with publically accessible variables
  • Move _firstRun into decorators to ensure styles are output
  • Make sure class Kint has not been defined yet. Fixes issue #165
  • Added other way how to install via composer
  • Remove self::_char( "═", 80 ) and Title if $returnOutput = true
  • Including doc about global usage, finally
  • added support for displaying objects' __toString() methods
  • Added coloring and hyperlinks for recursive references
  • Add ability to exclude certain class instances from being dumped
  • Bugfix: Check aliases case sensitive
  • Make kint minitrace more readable
  • Fixed $tabularData on overview.php
  • Return provided data
  • Vim navigation keys (& keyboard error fix)
kint questions on Stackoverflow (View All Questions)
  • Use kint from within twig template?
  • Problems installing kint correctly
  • How to disable Kint in local environment under Laravel 4
  • How can i use Kint Debugger in symfony controller
  • Kint and Codeigniter MAMP vs LAMP
kint list of languages used
kint latest release notes
2.2 2.2
  • Bugfixes
  • Added special access paths for some magic methods
  • Sort methods by line number after hierarchy
  • Sort properties with strnatcasecmp instead of strcmp
  • Added blacklist to ToString plugin, add SimpleXMLElement by default
  • Removed the value representation from unknown types
  • Removed object property reflection
  • Made some parser plugins opt-in:
    • Binary
    • Serialize
    • DOMNode/DOMIterator
  • Renderers can now alter parser plugins before parsing
    • The text-based renderers now disable all the plugins they don't use ahead of time
  • Added special access paths for more magic methods like __toString
  • Dropped automated testing of PHP 5.2
    • 5.2 will be dropped when TravisCI drops it in april
    • 5.1 and 5.2 are still technically supported, but since (hopefully) no-one uses those any huge bugs will be fixed on an as-reported basis.
  • Added Kint::dumpArray to allow you to supply your own object seeds (Names and access paths) along with an array of data. Useful for integrating with other systems.
    • This allows correct access paths for Kint::trace()
2.1.2 2.1.2

Most of this release is bugfixes, but there are a few notable changes.

  • Disabled the binary, DOMNode, DOMIterator, and Serialize plugins. They're still there but you have to opt-in now. For reasons behind these choices see #244
  • Max depth has been lowered to 6. Because Kint currently supplies much more information than v1 did it's also a bit slower. This is compounded by the constantly increasing interdependent hierarchies in use in modern PHP systems. Because the access paths are a thing in Kint 2 it's very easy to run a second dump to get deeper in, so this will barely make a dent for usability, but lowering the depth limit one level typically cuts runtime in 3!
  • There is now a parserPlugins method on the Kint_Renderer which can alter or supply a list of plugins for the parser to be initialized with. A whitelist on the text renderer makes use of this by disabling most of the plugins so text, cli, and plain dumps are fast.
  • Dropped reference detection support below 5.2.1. This had been causing infinite loops since alpha2 and no-one noticed. /me clumsily foreshadows impending PHP version requirement bump
2.1.1 2.1.1
  • Bugfixed accidental write to input variables in Closure plugin

This is a serious bug and the reason for the emergency patch release. This bug may affect operation of caller code in a default Kint 2.0+ installation. Please upgrade at your earliest convenience.

  • Removed value representation from unknown types
  • Stricter parsing and testing for Impossible index variables
  • Updated nodejs to use a lockfile
Other projects in PHP