kint Packagist

Kint - a powerful and modern PHP debugging tool.

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.
  • Read the full documentation for more information

Authors

Jonathan Vollebregt (jnvsor)
Rokas Šleinius (raveren)

License

Licensed under the MIT License

Related Repositories

kint

kint

Kint - a powerful and modern PHP debugging tool. ...

kint

kint

Kint - a powerful and modern PHP debugging tool. ...

craft_kint

craft_kint

Adds Kint, an in-app PHP debugger, to Craft CMS for use in Twig and PHP. ...

codeigniter-kint

codeigniter-kint

A modification to the Kint variable dumping library for use in CodeIgniter ...

CgKintBundle

CgKintBundle

This Symfony bundle lets you use the Kint function in your Twig templates. Kint is a print_r() replacement which produces a beautiful structured, collapsible and escaped output ...


Top Contributors

jnvsor raveren aljinovic Rarst carlos-granados tgr GrahamCampbell will123195 schlessera vinculis frosas istvan-ujjmeszaros eimajenthat larrybolt pborreli plugowski sergeifilippov ulentini efalder413 mcd-php willzyx-dev

Releases

-   v0.9.1 zip tar
-   v0.9 zip tar
-   deprecated-v0.9 zip tar
-   2.1.2 zip tar
-   2.1.1 zip tar
-   2.1 zip tar
-   2.0 zip tar
-   2.0-rc1 zip tar
-   2.0-beta2 zip tar
-   2.0-beta1 zip tar
-   2.0-alpha5 zip tar
-   2.0-alpha4 zip tar
-   2.0-alpha3 zip tar
-   2.0-alpha2 zip tar
-   2.0-alpha1 zip tar
-   1.1 zip tar
-   1.0.10 zip tar
-   1.0.6 zip tar
-   1.0.3 zip tar
-   1.0.2 zip tar
-   1.0.0 zip tar