kint Display the contents of vars in a readable way.

  1. Requirements
  2. Setup
  3. Usage

Kint is a simple tool that presents the contents of a variable in a readable way. It's an alternative to var_dump() or scripts like Krumo.

You can find more information on the site of the original class.

screenshot

Requirements

Tested on 1.1.8. Should work on earlier versions.

Setup

  • Download and extract the folder under protected/extensions.
  • Add to your config (main.php) under components:
'kint' => array(
    'class' => 'ext.Kint.Kint',
),

Add it to your preload property (this is only for declaring the shortcut functions):

'preload' => array('log', 'kint'),

Note: You can still use the plugin without autoloading, but instead of using the shortcut functions, you have to use:

Kint::dump($variable);

Usage

To dump a variable:

d($variable);

There is often a need to halt execution after dumping a particular variable:

dd($variable); // execution will stop after this statement; same as d($variable);die;

To print out variable information in simple text (no CSS style or javascript) use

s($variable); // stands for "simple"
    // or, as before
  sd($variable); // this will halt execution after displaying data

There are also (currently two) modifiers:

+d($variable); // will dump variable information without limiting the depth
    /// and
  -d($variable); // will run ob_clean() beforehand, so this dump is at the top
                   // of the page. Best used with dd().

The latter are possible because the class analyzes the PHP code itself where it was called from.

Last, but not least, you can output a pretty and readable backtrace:

Kint::trace();
17 0
19 followers
1 379 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Logging
Developed by: wisp
Created on: Dec 24, 2011
Last updated: 11 years ago

Downloads

show all

Related Extensions