Download the PHP package hackerpro536/kint without Composer
On this page you can find all versions of the php package hackerpro536/kint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hackerpro536/kint
More information about hackerpro536/kint
Files in hackerpro536/kint
Package kint
Short Description Kint - debugging helper for PHP developers. Version edited by Hackerpro536
License MIT
Homepage https://github.com/hackerpro536/kint
Informations about the package kint
Kint - debugging helper for PHP developers
Installation and Usage
One of the main goals of Kint is to be zero setup.
Download the archive and simply
Or, if you use Composer:
Or just run composer require hackerpro536/kint
That's it, you can now use Kint to debug your code:
Note, that Kint does have configuration (like themes and IDE integration!), but it's in need of being rewritten, so I'm not documenting it yet.
Tips & Tricks
- Kint is enabled by default, call
Kint::enabled(false);to turn its funcionality completely off. 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. sd()andddd()are shorthands fors();die;andd();die;respectively.- Important: The older shorthand
dd()is deprecated due to compatibility issues and will eventually be removed. Use the analogousddd()instead.
- Important: The older shorthand
- When looking at Kint output, press D on the keyboard and you will be able to traverse the tree with arrows and tab keys - and expand/collapse nodes with space or enter.
- Double clicking the
[+]sign in the output will expand/collapse ALL nodes; triple clicking big blocks of text will select it all. - Clicking the tiny arrows on the right of the output open it in a separate window where you can keep it for comparison.
-
To catch output from Kint just assign it to a variablebeta
- 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 huge objects)!d($var)will show expanded rich output.-d($var)will attempt toob_cleanthe previous output so if you're dumping something inside a HTML page, you will still see Kint output. You can combine modifiers too:~+d($var)
-
To force a specific dump output type just pass it to the
Kint::enabled()method. Available options are:Kint::MODE_RICH(default),Kint::MODE_PLAIN,Kint::MODE_WHITESPACEandKint::MODE_CLI: - To change display theme, use
Kint::$theme = '<theme name>';where available options are:'original'(default),'solarized','solarized-dark'and'aante-light'. Here's an (outdated) preview: - Kint also includes a naïve profiler you may find handy. It's for determining relatively which code blocks take longer than others: