voku / kint
Kint - debugging helper for PHP developers
Installs: 4 672
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 292
Open Issues: 1
Requires
- php: >=5.3.0
- voku/portable-utf8: ~3.0
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2023-04-03 23:58:42 UTC
README
There is a new maintained version of Kint! -> (kint-php)[https://github.com/kint-php/kint] thx@jnvsor
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 exampleKint::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