PHPackages                             cg/kint-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. cg/kint-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

cg/kint-bundle
==============

This bundle lets you use the Kint function in your Twig templates. Kint is a print\_r() replacement which produces a structured, collapsible and escaped output

v0.2(4y ago)22125.8k11[2 issues](https://github.com/barelon/CgKintBundle/issues)1MITPHPPHP &gt;=5.3.2

Since Oct 1Pushed 4y ago5 watchersCompare

[ Source](https://github.com/barelon/CgKintBundle)[ Packagist](https://packagist.org/packages/cg/kint-bundle)[ Docs](http://github.com/barelon/CgKintBundle)[ RSS](/packages/cg-kint-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (5)Used By (1)

Description
===========

[](#description)

This bundle lets you use the [Kint](https://github.com/raveren/kint) library in your Twig templates.

This bundle adds a new Twig **kint()** function which is a replacement for the Twig **dump()** function. Extremely easy to use but very powerful. Some of its features:

- Much more elegant and readable output - structured, collapsible and escaped.
- The name of the twig variable is displayed.
- Accepts any number of parameters in one call and groups them for you to see what was dumped in different iterations.
- Handles recursive variables.
- Much more information is displayed about the variable in many cases:
    - static properties of the dumped objects class;
    - specific types of data are recognized and displayed in a custom way (eg. JSON, XML strings);
    - if a resource variable is of an opened file, the file name is displayed and much more...
- Complex variables are dumped with a fixed nested depth so that it doesn't hang up your browser for enormous objects.

Installation
============

[](#installation)

Using Composer (for Symfony 2.1)
--------------------------------

[](#using-composer-for-symfony-21)

Add the Kint Bundle in your `composer.json` file:

```
{
    "require": {
        "cg/kint-bundle": "dev-master"
    }
}
```

Now tell composer to download the bundle by running the command:

```
$ php composer.phar update Cg/KintBundle
```

Composer will install the bundle and Kint in your project's `vendor` directory.

Using Deps (for Symfony 2.0)
----------------------------

[](#using-deps-for-symfony-20)

1- Add this to your `Deps` file:

```
[Kint]
    git=http://github.com/raveren/kint.git
    target=raveren/kint

[KintBundle]
    git=http://github.com/barelon/CgKintBundle.git
    target=bundles/Cg/KintBundle
```

2- run `./bin/vendors install`

3- Add the `Cg` namespace to your autoloader:

```
// app/autoload.php

$loader->registerNamespaces(array(
    // ...
    'Cg' => __DIR__.'/../vendor/bundles',
));
```

4- Add a classmap to your autoloader so that it can load the Kint class. Add this line at the beginning of the `app/autoload.php` file

```
use Symfony\Component\ClassLoader\MapClassLoader;
```

And add this code snippet at the end of that file:

```
// Create map autoloader
$mapLoader = new MapClassLoader(array(
    'Kint' => __DIR__.'/../vendor/raveren/kint/Kint.class.php',
));

$mapLoader->register();
```

Update your AppKernel (for both Symfony 2.1 and 2.0)
----------------------------------------------------

[](#update-your-appkernel-for-both-symfony-21-and-20)

Finally, enable the bundle in the kernel:

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Cg\KintBundle\CgKintBundle(),
    );
}
```

Usage
=====

[](#usage)

Within any Twig template use

```
{{kint(var1,var2,...)}}

```

This will dump on screen the values of these Twig variables. They will be shown in a beautiful format, with a collapsable hierarchical view. Click on any variable name to open or collapse one level or click the `+` and `-` signs to open or collapse all levels.

If you don´t include any variable names in your kint() call, like this:

```
{{kint()}}

```

then the whole Twig Context with all its variables will be dumped.

Configuration
=============

[](#configuration)

In your `app/config/config.yml` file you can include

```
cg_kint:
    enabled:          true
    nesting_depth:    5
    string_length:    60
```

- The `enabled` parameter defines if kint output is enabled or not. Set this to false and Kint will not output anything, you probably want to set this to false for the prod environment.
- The `nesting_depth` parameter defines the maximum depth of nesting in object/array variables that Kint will show. Use 0 for infinite depth. Kint will recognize recursion in variables and will not hang your browser.
- The `string_length` parameter defines the maximum lenth of strings shown. If a string is longer than that it will be shown truncated with a link to see it fully.

All these parameters are optional. If you don´t include them they will take the default values shown above.

License
=======

[](#license)

This bundle is under the MIT license. See the complete license in the bundle:

```
Resources/meta/LICENSE

```

About
=====

[](#about)

KintBundle has been created by [Carlos Granados](https://github.com/barelon).

Kint was created by [Rokas Šleinius](https://github.com/raveren).

See also the list of [contributors](https://github.com/barelon/cgkintbundle/contributors).

Reporting an issue or a feature request
=======================================

[](#reporting-an-issue-or-a-feature-request)

Issues and feature requests are tracked in the [Github issue tracker](https://github.com/barelon/cgkintbundle/issues).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~947 days

Total

4

Last Release

1768d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2636f870530771eeacdaa267730b05040bf6f96fd7ebe0d51696be25b2d7bba?d=identicon)[barelon](/maintainers/barelon)

---

Top Contributors

[![iliegurzun](https://avatars.githubusercontent.com/u/12234001?v=4)](https://github.com/iliegurzun "iliegurzun (3 commits)")[![michaelesmith](https://avatars.githubusercontent.com/u/181546?v=4)](https://github.com/michaelesmith "michaelesmith (1 commits)")[![mikeSimonson](https://avatars.githubusercontent.com/u/907613?v=4)](https://github.com/mikeSimonson "mikeSimonson (1 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (1 commits)")

---

Tags

symfonybundletwigdebugkint

### Embed Badge

![Health badge](/badges/cg-kint-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/cg-kint-bundle/health.svg)](https://phpackages.com/packages/cg-kint-bundle)
```

###  Alternatives

[yellowskies/qr-code-bundle

Symfony Barcode &amp; QR Code Generator Bundle with Twig extension

36682.9k](/packages/yellowskies-qr-code-bundle)[nucleos/antispam-bundle

This bundle provides some basic features to reduce spam in symfony forms.

52105.1k](/packages/nucleos-antispam-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
