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.

Revisions

  1. raveren revised this gist Oct 2, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,10 @@
    # disable the weird fold on the bottom of the page and just display Kint where it was called.
    Kint\Renderer\RichRenderer::$folder = false;

    # make it usable on php frameworks of 2021+
    Kint\Parser\BlacklistPlugin::$shallow_blacklist[] =
    'Psr\\Containe\\ContainerInterface';

    # Everywhere a file path is displayed you can click on it to open directly in PhpStorm
    # Requires plugin
    # Phpstorm -> Settings -> Plugins -> Marketplace -> Remote Call.
  2. raveren revised this gist Oct 2, 2021. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -93,8 +93,4 @@ function sd()
    }

    Kint::$aliases[] = 'sd';
    }

    if (file_exists(__DIR__.'/../sandbox.php')) {
    require __DIR__.'/../sandbox.php';
    }
    }
  3. raveren revised this gist Oct 2, 2021. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php

    /* ####################################################################
    * Original, please contribute your changes:
    * Original, changes welcome:
    *
    * https://gist.github.com/raveren/eba373d8abb572b0528c73d145103f95
    *
    @@ -36,7 +36,7 @@
    # Everywhere a file path is displayed you can click on it to open directly in PhpStorm
    # Requires plugin
    # Phpstorm -> Settings -> Plugins -> Marketplace -> Remote Call.
    Kint\Kint::$file_link_format = 'http://localhost:8091/?message=%f:%l';
    Kint\Kint::$file_link_format = 'phpstorm://open?file=%f&line=%l';

    # show full (not edited) path to files so I can click em in console
    Kint\Kint::$app_root_dirs = [
    @@ -93,4 +93,8 @@ function sd()
    }

    Kint::$aliases[] = 'sd';
    }
    }

    if (file_exists(__DIR__.'/../sandbox.php')) {
    require __DIR__.'/../sandbox.php';
    }
  4. raveren revised this gist Sep 25, 2021. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -93,8 +93,4 @@ function sd()
    }

    Kint::$aliases[] = 'sd';
    }

    if (file_exists(__DIR__.'/../sandbox.php')) {
    require __DIR__.'/../sandbox.php';
    }
    }
  5. raveren revised this gist Sep 25, 2021. 1 changed file with 29 additions and 9 deletions.
    38 changes: 29 additions & 9 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php

    /* ####################################################################
    * Original, changes welcome:
    * Original, please contribute your changes:
    *
    * https://gist.github.com/raveren/eba373d8abb572b0528c73d145103f95
    *
    @@ -11,9 +11,9 @@
    *
    * HOW TO USE?
    *
    * Add this file to the `autoload-dev.files` configuration in composer.json:
    * Add this file to the `autoload.files` configuration in composer.json:
    *
    * "autoload-dev": {
    * "autoload": {
    * "psr-4": {
    * "App\\": "src/"
    * },
    @@ -53,28 +53,48 @@ function kd()
    {
    $args = func_get_args();

    call_user_func_array(array('Kint', 'dump'), $args);
    call_user_func_array(['Kint', 'dump'], $args);

    die;
    }

    Kint::$aliases[] = 'kd';
    }

    if (! function_exists('ss')) {
    function ss()
    {
    if (! Kint::$enabled_mode) {
    return 0;
    }

    $stash = Kint::$enabled_mode;
    Kint::$enabled_mode = Kint::MODE_TEXT;

    $args = func_get_args();
    $out = call_user_func_array(['Kint', 'dump'], $args);

    Kint::$enabled_mode = $stash;

    return $out;
    }

    Kint::$aliases[] = 'ss';
    }

    if (!function_exists('sd')) {
    /**
    * Alias of kd(), just outputs plain htmlescaped text.
    */
    function sd()
    {
    $args = func_get_args();

    call_user_func_array('s', $args);
    call_user_func_array('ss', $args);

    die;
    }

    Kint::$aliases[] = 'sd';
    }
    ##################################

    if (file_exists(__DIR__.'/../sandbox.php')) {
    require __DIR__.'/../sandbox.php';
    }
  6. raveren revised this gist May 23, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -11,9 +11,9 @@
    *
    * HOW TO USE?
    *
    * Add this file to the `autoload.files` configuration in composer.json:
    * Add this file to the `autoload-dev.files` configuration in composer.json:
    *
    * "autoload": {
    * "autoload-dev": {
    * "psr-4": {
    * "App\\": "src/"
    * },
    @@ -77,4 +77,4 @@ function sd()

    Kint::$aliases[] = 'sd';
    }
    ##################################
    ##################################
  7. raveren revised this gist Apr 23, 2021. 1 changed file with 26 additions and 37 deletions.
    63 changes: 26 additions & 37 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,42 +1,50 @@
    <?php

    /**
    /* ####################################################################
    * Original, changes welcome:
    *
    * https://gist.github.com/raveren/eba373d8abb572b0528c73d145103f95
    *
    * More info:
    *
    * https://kint-php.github.io/kint/settings/
    *
    * 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
    ]
    },
    *
    * "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.
    */
    * ################################################################## */

    # don't kill the vibe if something's wrong
    if (!class_exists('Kint\Renderer\RichRenderer')) {
    return;
    }

    // disable the weird fold on the bottom of the page and just display Kint where it was called.
    # 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

    # Everywhere a file path is displayed you can click on it to open directly in PhpStorm
    # Requires plugin
    # Phpstorm -> Settings -> Plugins -> Marketplace -> Remote Call.
    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

    # 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
    ##################################
    # add convenient shorthand aliases
    if (!function_exists('kd')) {
    /**
    * Alias of Kint::dump(); die; is compatible with symfony & laravel (it leaves their dd helper alone)
    @@ -69,23 +77,4 @@ function sd()

    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';
    }
    ##################################
  8. raveren revised this gist Apr 23, 2021. 1 changed file with 15 additions and 11 deletions.
    26 changes: 15 additions & 11 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,29 @@
    <?php

    /**
    * Original, changes welcome:
    *
    * Original, changes welcome:
    *
    * https://gist.github.com/raveren/eba373d8abb572b0528c73d145103f95
    *
    *
    * 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
    ]
    },
    "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.
    */

    if (!class_exists('Kint\Renderer\RichRenderer')) {
    return;
    }

    // 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 -
  9. raveren revised this gist Apr 21, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,10 @@
    <?php

    /**
    * Original, changes welcome:
    *
    * https://gist.github.com/raveren/eba373d8abb572b0528c73d145103f95
    *
    * HOW TO USE?
    *
    * Add this file to the `autoload.files` configuration in composer.json:
  10. raveren revised this gist Jan 23, 2021. 1 changed file with 14 additions and 14 deletions.
    28 changes: 14 additions & 14 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -17,27 +17,27 @@
    */

    // disable the weird fold on the bottom of the page and just display Kint where it was called.
    \Kint\Renderer\RichRenderer::$folder = false;
    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
    // 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';
    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']),
    Kint\Kint::$app_root_dirs = [
    realpath($_SERVER['DOCUMENT_ROOT']) => realpath($_SERVER['DOCUMENT_ROOT']),
    ];

    // add convenient shorthand aliases
    if (!\function_exists('kd')) {
    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();
    $args = func_get_args();

    \call_user_func_array(array('\Kint', 'dump'), $args);
    call_user_func_array(array('Kint', 'dump'), $args);

    die;
    }
    @@ -46,23 +46,23 @@ function kd()
    }


    if (!\function_exists('sd')) {
    if (!function_exists('sd')) {
    /**
    * Alias of kd(), just outputs plain htmlescaped text.
    */
    function sd()
    {
    $args = \func_get_args();
    $args = func_get_args();

    \call_user_func_array('s', $args);
    call_user_func_array('s', $args);

    die;
    }

    Kint::$aliases[] = 'sd';
    }

    if (!\function_exists('ssd')) {
    if (!function_exists('ssd')) {
    /**
    * Alias of kd(), just returns simple text, no escapes, new lines are \n.
    *
    @@ -72,9 +72,9 @@ function ssd()
    {
    Kint::$enabled_mode = Kint::MODE_TEXT;

    $args = \func_get_args();
    $args = func_get_args();

    \call_user_func_array(array('\Kint', 'dump'), $args);
    call_user_func_array(array('Kint', 'dump'), $args);

    die;
    }
  11. raveren revised this gist Jan 23, 2021. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,34 @@
    <?php

    /**
    * HOW TO USE?
    *
    * Add this file to the `autoload.files` configuration in composer.json:
    "autoload": {
    "psr-4": {
    "App\\": "src/"
    },
    "files": [
    "config/kint.php"
    "config/kint.php" <--------------- this line
    ]
    },
    *
    * Or, if you don't use Composer, just include this file anywhere after Kint is included.
    */

    // hide the fold on the bottom of the page and just display Kint where it was called.
    // disable the weird 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
    // 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 path to files so I can click em in console
    // 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)
  12. raveren revised this gist Jan 20, 2021. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    <?php
    declare(strict_types=1);

    /**
    * Add this file to the `autoload.files` configuration in composer.json:
    @@ -29,10 +28,6 @@
    function kd()
    {
    $args = \func_get_args();
    Kint::$enabled_mode = Kint::MODE_CLI;
    Kint::$cli_detection = false;
    Kint::$mode_default_cli = false;


    \call_user_func_array(array('\Kint', 'dump'), $args);

  13. raveren revised this gist Jan 20, 2021. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,26 @@
    <?php
    declare(strict_types=1);

    /**
    * Add this file to the `autoload-dev.files` configuration in composer.json:
    "autoload-dev": {
    * 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';
    \Kint\Kint::$file_link_format = 'http://localhost:8091/?message=%f:%l';
    // show full path to files so I can click em in console
    \Kint\Kint::$app_root_dirs = [
    \realpath($_SERVER['DOCUMENT_ROOT']) => \realpath($_SERVER['DOCUMENT_ROOT']),
    ];

    if (!\function_exists('kd')) {
    /**
    @@ -25,6 +29,10 @@
    function kd()
    {
    $args = \func_get_args();
    Kint::$enabled_mode = Kint::MODE_CLI;
    Kint::$cli_detection = false;
    Kint::$mode_default_cli = false;


    \call_user_func_array(array('\Kint', 'dump'), $args);

    @@ -55,7 +63,7 @@ function sd()
    /**
    * Alias of kd(), just returns simple text, no escapes, new lines are \n.
    *
    * Useful for cli when autodetection fails, logfiles and RESTful requests.
    * Useful for cli when autodetection fails, logfiles and RESTful requests.
    */
    function ssd()
    {
  14. raveren revised this gist Jan 19, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    <?php

    /**
    * Add this file to the `autoload.files` configuration in composer.json:
    "autoload": {
    * Add this file to the `autoload-dev.files` configuration in composer.json:
    "autoload-dev": {
    "psr-4": {
    "App\\": "src/"
    },
  15. raveren revised this gist Jan 19, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@
    "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.
  16. raveren revised this gist Jan 19, 2021. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,17 @@
    <?php

    /**
    * Add this file to the `autoload.files` configuration in composer.json:
    "autoload": {
    "psr-4": {
    "App\\": "src/"
    },
    "files": [
    "config/kint.php"
    ]
    },
    */

    // 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
  17. raveren revised this gist Jan 15, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    <?php

    // 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';
  18. raveren revised this gist Jan 15, 2021. No changes.
  19. raveren created this gist Jan 15, 2021.
    58 changes: 58 additions & 0 deletions kint.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@
    <?php

    \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';
    }