Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Print $CI object for debugging

Hey, I wonder how do you debug Fuel CMS?
I usually use KINT ( to print variables, objects etc. The nice thing about KINT is, that it also shows me methods and hints. Unfortunately, when I want to output($CI) or even subsets d($CI->fuel), the server runs out of memory. The same happens for var_dump($CI). Why is that and how to achieve, what I described?


  • FUEL doesn't have it's own debugging function (although it would be a nice addition I think). The $CI object has child objects that have properties that reference the $CI object and so debugging that object can be problematic since it causes and infinite loop (although I thought Kint handled that but perhaps not). There are a couple of homegrown functions found here to help with that:

  • Thanks for hinting Kint depth limit. It works to lower the limit.

    In case someone is interested in it:

    I installed Kint via composer (so it's available in the framework, see config.php -> $config['composer_autoload']).

    Created \fuel\application\helpers\kint_helper.php(enabled it in autoload.php) with the following content

    // Kint Debug Helper
    //\Kint::$plugins = ['Kint_Parser_Trace','Kint_Parser_Json','Kint_Parser_Color'];
    \Kint::$max_depth = 2;
     * ddd() was removed from kint core so we have to create it on our own and alias it in kint
     * @param array ...$v
    function ddd(...$v){
    \Kint::$aliases[] = 'ddd';
    Kint_Parser_Blacklist::$blacklist[] = 'CI_User_agent';
    // not sure how to use this. I suppose, Twig can be blacklisted here.
    Kint_Parser_Blacklist::$shallow_blacklist[] = 'Psr\Container\ContainerInterface';
    $test = [1,[2,[3,[4]]]];

    As much as I love Kint, I think Tracy would be a great addition to fuel cms for exception handling and debugging. What do you think?

  • Thanks for the code example. I believe CI 4 is using that now too:

Sign In or Register to comment.