Getting Kint to Work With Laravel 4.1


Kint is a PHP tool that helps ease the pain of debugging PHP (which we all know is our favorite part of the job). This is what their website has to say:

Kint for PHP is a tool designed to present your debugging data in the absolutely best way possible.

Essentially what it does is takes PHP's output from the var_dump() and debug_backtrace() function and formats it nicely. Using Kint, you can look at a well organized representation of your arrays, objects, error messages and exceptions. Anything that var_dump() accepts, really. Here is a shot of it displaying the $_SERVER array:

Kint and Laravel | Kint is a powerful debug tool for PHP.

While Kint is not really part of Laravel itself, using it in conjunction with Laravel's dd function is a powerful combination. However, with Laravel's recent update, some users, including myself, were having issues getting Kint to work with Laravel. The solution that worked for me was to change the order of the dependencies in the composer.json file.

Modifying The composer.json File

This solution works by making sure that Kint is loaded before Laravel:

"require": {
    "raveren/kint": "dev-master",
    "laravel/framework": "4.1.*"

After this change has been made, you will essentially have to perform a fresh composer install for your project. This involves removing the composer.lock file and the entire vendor directory.

Manually Adjusting The autoload_files.php File

If you do not want to remove your composer.lock file or your vendor directory, you can also manually adjust the autoload_files.php file located in the vendor/composer/ directory. Again, just make sure that Kint is loaded before Laravel:


// autoload_files.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(

    $vendorDir . '/raveren/kint/Kint.class.php',
    $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',

The drawback to this method is that this change must be made every time composer updates your project's dependencies.


There are probably better ways to solve this problem. The two solutions above have worked for me, and if anyone has questions or comments (or even has another way to solve this issue that might be better), feel free to leave a comment below!

Start the Discussion

Leave a comment

Subscribe to our newsletter