drKintPlugin - 1.0.2

Symfony integration of Kint

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

drKintPlugin

This plugin provides a very basic integration of the Kint debugging tool (see the Kint project's website) in your Symfony project.

Installation and configuration

  1. Download the plugin and copy it to your project's plugins directory.
  2. Enable the plugin in your ProjectConfiguration class (/config/ProjectConfiguration.class.php).

Usage

The trace and variable dump functions as provided by Kint are by default available in your project (as helper functions).

To dump a variable:

Kint::dump($variable1,$variable2);
// or simply
d($variable1,$variable2); //alias of Kint::dump()

There is often a need to halt execution after dumping a particular variable:

dd($variable); // execution will stop after this statement

To print out variable information in simple text use:

s($variable); // stands for "simple"
// or, as before
sd($variable); // this will halt execution after displaying data

See also the Kint project's website for more examples.

Configuration

In your app.yml file, the following settings may be added (the settings below are the defaults):

all:
  kint:
    enabled: true
    max_str_length: 60
    max_levels: 5
    skin: kint.css

Updating the Kint core files

For Kint to work as part of a Symfony plugin, I had to take the following steps:

  1. Rename kint.class.php to Kint.class.php
  2. Move the helper functions in this file to the file lib/helper/KintHelper.php
  3. Change the first argument of the call_user_func in the helper functions to 'Kint'
  4. Move initialization of global settings to config/drKintPluginConfiguration.class.php

Whenever a new version of Kint is released, you should repeat these steps to make Kint work again.