|
| 1 | +=== Kint PHP Debugger === |
| 2 | +Contributors: hellofromTonya |
| 3 | +Donate link: https://hellofromtonya.com |
| 4 | +Tags: debug, debugger, kint, var_dump, print_r, backtrace, trace, debug_backtrace |
| 5 | +Requires at least: 3.5 |
| 6 | +Tested up to: 5.1 |
| 7 | +Stable tag: 1.2.0 |
| 8 | +License: GPLv2 or later |
| 9 | +License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 10 | + |
| 11 | +Kint is a modern and powerful PHP debugging helper, which requires zero-setup and replaces var_dump(), print_r() and debug_backtrace(). |
| 12 | + |
| 13 | +== Description == |
| 14 | + |
| 15 | +This WordPress plugin is a wrapper for the [Kint](https://kint-php.github.io/kint/) PHP Debugger utility version 1.x. Now instead of using var_dump() or print_r(), you simply use d() with zero, nadda, no formatting required. |
| 16 | + |
| 17 | +Use this tool when you are debugging your website, in place of **[var_dump()](http://php.net/manual/en/function.var-dump.php)**, **[print_r()](http://php.net/manual/en/function.print-r.php)** and **[debug_backtrace()](http://php.net/manual/en/function.debug-backtrace.php)**. |
| 18 | + |
| 19 | += Handy Tools = |
| 20 | + |
| 21 | +Some handy tools just for the PHP Developer: |
| 22 | + |
| 23 | +* `d( $var );` to render a collapsible UI container which displays your variable data in "the most informative way" |
| 24 | +* `ddd( $var );` same as d() except that it also executes `die()` to halt execution. |
| 25 | +See the [screenshot 1](http://wordpress.org/extend/plugins/kint-php-debugger/screenshots/) for more details. |
| 26 | + |
| 27 | +Here are some variations of d() to give you the display you want: |
| 28 | + |
| 29 | +* '~d( $var );' outputs in plain text format. |
| 30 | +* '+d( $var );' disregards depth level limits and outputs everything |
| 31 | +* '!d( $var );' shows expanded rich output |
| 32 | +* '-d( $var );' attempts to ob_clean() the previous output (dump something inside of HTML) |
| 33 | + |
| 34 | += Profiler = |
| 35 | + |
| 36 | +Kint even includes a naïve profiler, which can help you analyze which blocks of code take longer than others: |
| 37 | +`Kint::dump( microtime() ); // just pass microtime() |
| 38 | +sleep( 1 ); |
| 39 | +Kint::dump( microtime(), 'after sleep(1)' ); |
| 40 | +sleep( 2 ); |
| 41 | +ddd( microtime(), 'final call, after sleep(2)' );` |
| 42 | + |
| 43 | +See [screenshot 2](http://wordpress.org/extend/plugins/kint-php-debugger/screenshots/) for what is rendered out in your browser. |
| 44 | + |
| 45 | +== Installation == |
| 46 | + |
| 47 | += From your WordPress dashboard = |
| 48 | + |
| 49 | +1. Visit 'Plugins > Add New' |
| 50 | +2. Search for 'Kint PHP Debugger' |
| 51 | +3. Activate Kint PHP Debugger from your Plugins page. |
| 52 | + |
| 53 | += Once Activated = |
| 54 | + |
| 55 | +Whenever you want to dump out the data within a variable, simply use `d( $var )` to replace when you do pre + var_dump(). |
| 56 | + |
| 57 | +To dump and die, you use `ddd( $var );`. |
| 58 | + |
| 59 | +== Frequently Asked Questions == |
| 60 | + |
| 61 | += How do I use this utility? = |
| 62 | + |
| 63 | +When you are testing your code, you use d( $var ) in place of var_dump( $var ) and print_r( $var ). No need to wrap it in pre's either. |
| 64 | + |
| 65 | += What does it render in the browser? = |
| 66 | + |
| 67 | +Kint provides a handy UI that wraps up the data within the variable. Click to open it up and see the data. |
| 68 | + |
| 69 | +See the [screenshot 1](http://wordpress.org/extend/plugins/kint-php-debugger/screenshots/) for an example. |
| 70 | + |
| 71 | += What else does Kint provide to help me debug? = |
| 72 | + |
| 73 | +As you can see the [screenshot 1](http://wordpress.org/extend/plugins/kint-php-debugger/screenshots/), besides the handy UI, it also provides you with a full call stack. Click on the text below the UI to expand it out. |
| 74 | + |
| 75 | += Can I run this on a live site? = |
| 76 | + |
| 77 | +I wouldn't unless you are testing. This tool is for debug only. Once you push the site live, deactivate and delete this plugin. |
| 78 | + |
| 79 | += What should I do when the site goes live? = |
| 80 | + |
| 81 | +Deactivate and delete this plugin. |
| 82 | + |
| 83 | +== Screenshots == |
| 84 | + |
| 85 | +1. An example of what gets rendered in the browser when using 'd( $var )'. |
| 86 | +2. Profiler example from Kint. |
| 87 | + |
| 88 | +== ChangeLog == |
| 89 | + |
| 90 | += Version 1.2.0 = |
| 91 | + |
| 92 | +* Excluded Composer files. |
| 93 | +* Tested with WordPress 5.1. |
| 94 | + |
| 95 | += Version 1.1.0 to 1.1.4 = |
| 96 | + |
| 97 | +* Changed to the kint-php package |
| 98 | +* Upgraded Kint to v1.1 |
| 99 | + |
| 100 | += Version 1.0.1 = |
| 101 | + |
| 102 | +* Upgraded Kint to v1.0.10 |
| 103 | + |
| 104 | += Version 1.0.0 = |
| 105 | + |
| 106 | +* First release |
| 107 | + |
| 108 | +== Upgrade Notice == |
0 commit comments