voku/kint

This package is abandoned and no longer maintained. The author suggests using the kint-php/kint package instead.

Kint - debugging helper for PHP developers

2.0.10 2016-08-12 10:51 UTC

README

Stories in Ready Build Status Coverage Status Scrutinizer Code Quality Codacy Badge SensioLabsInsight Dependency Status Latest Stable Version Total Downloads Latest Unstable Version PHP 7 ready License

There is a new maintained version of Kint! -> (kint-php)[https://github.com/kint-php/kint] thx@jnvsor

Screenshot

What am I looking at?

At first glance Kint is just a pretty replacement for var_dump(), print_r() and debug_backtrace().

Installation and Usage

Composer:

"require": {
   "voku/kint": "^2.0"
}

Or just run composer require voku/kint

That's it, you can now use Kint to debug your code:

use kint\Kint;

Kint::enabled(true);

########## DUMP VARIABLE ###########################
Kint::dump($GLOBALS, $_SERVER); // pass any number of parameters

// or simply use d() as a shorthand:
\kint\d($_SERVER);


########## DEBUG BACKTRACE #########################
Kint::trace();
// or via shorthand:
\kint\d(1);


############# BASIC OUTPUT #########################
# this will show a basic javascript-free display
\kint\s($GLOBALS);


########## MISCELLANEOUS ###########################
# this will disable kint completely
Kint::enabled(false);

\kint\dd('Get off my lawn!'); // no effect

Kint::enabled(true);
\kint\dd( 'this line will stop the execution flow because Kint was just re-enabled above!' );

WARNING / INFO

  • Kint is disabled by default, call kint\Kint::enabled(true); to turn its funcionality on. The best practice is to enable Kint in DEVELOPMENT environment only (or for example Kint::enabled($_SERVER['REMOTE_ADDR'] === '<your IP>');) - so even if you accidentally leave a dump in production, no one will know.

Author

Rokas Šleinius (Raveren)

License

Licensed under the MIT License