Skip to content

Instantly share code, notes, and snippets.

@raveren
Last active October 2, 2021 14:36
Show Gist options
  • Select an option

  • Save raveren/eba373d8abb572b0528c73d145103f95 to your computer and use it in GitHub Desktop.

Select an option

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/
<?php
/**
* Add this file to the `autoload.files` configuration in composer.json:
"autoload": {
"psr-4": {
"App\\": "src/"
},
"files": [
"config/kint.php"
]
},
* run `composer dump-autoload` or `composer update` after you do this.
*/
// hide the fold on the bottom of the page and just display Kint where it was called.
\Kint\Renderer\RichRenderer::$folder = false;
// next line requires PhpStorm with https://plugins.jetbrains.com/plugin/6027-remote-call plugin
\Kint\Kint::$file_link_format = 'http://localhost:8091/?message=%f:%l';
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