Last active
October 2, 2021 14:36
-
-
Save raveren/eba373d8abb572b0528c73d145103f95 to your computer and use it in GitHub Desktop.
Config file for Kint (php debug helper). More info: https://kint-php.github.io/kint/settings/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * HOW TO USE? | |
| * | |
| * Add this file to the `autoload.files` configuration in composer.json: | |
| "autoload": { | |
| "psr-4": { | |
| "App\\": "src/" | |
| }, | |
| "files": [ | |
| "config/kint.php" <--------------- this line | |
| ] | |
| }, | |
| * | |
| * Or, if you don't use Composer, just include this file anywhere after Kint is included. | |
| */ | |
| // disable the weird fold on the bottom of the page and just display Kint where it was called. | |
| \Kint\Renderer\RichRenderer::$folder = false; | |
| // Next setting requires PhpStorm with https://plugins.jetbrains.com/plugin/6027-remote-call plugin - | |
| // easiest way to install it is from phpstorm settings->plugins->market->search for Remote Call. | |
| // This makes it so if you have PhpStorm open, everywhere a file path is displayed you can click | |
| // on it and it will open in the PhpStorm IDE | |
| \Kint\Kint::$file_link_format = 'http://localhost:8091/?message=%f:%l'; | |
| // show full (not edited) path to files so I can click em in console | |
| \Kint\Kint::$app_root_dirs = [ | |
| \realpath($_SERVER['DOCUMENT_ROOT']) => \realpath($_SERVER['DOCUMENT_ROOT']), | |
| ]; | |
| // add convenient shorthand aliases | |
| if (!\function_exists('kd')) { | |
| /** | |
| * Alias of Kint::dump(); die; is compatible with symfony & laravel (it leaves their dd helper alone) | |
| */ | |
| function kd() | |
| { | |
| $args = \func_get_args(); | |
| \call_user_func_array(array('\Kint', 'dump'), $args); | |
| die; | |
| } | |
| Kint::$aliases[] = 'kd'; | |
| } | |
| if (!\function_exists('sd')) { | |
| /** | |
| * Alias of kd(), just outputs plain htmlescaped text. | |
| */ | |
| function sd() | |
| { | |
| $args = \func_get_args(); | |
| \call_user_func_array('s', $args); | |
| die; | |
| } | |
| Kint::$aliases[] = 'sd'; | |
| } | |
| if (!\function_exists('ssd')) { | |
| /** | |
| * Alias of kd(), just returns simple text, no escapes, new lines are \n. | |
| * | |
| * Useful for cli when autodetection fails, logfiles and RESTful requests. | |
| */ | |
| function ssd() | |
| { | |
| Kint::$enabled_mode = Kint::MODE_TEXT; | |
| $args = \func_get_args(); | |
| \call_user_func_array(array('\Kint', 'dump'), $args); | |
| die; | |
| } | |
| Kint::$aliases[] = 'ssd'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment