PHPackages                             intaro/twig-injection-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. intaro/twig-injection-bundle

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

intaro/twig-injection-bundle
============================

The TwigInjectionBundle allows to inject twig templates through the event behavior

v3.0.0(1y ago)7727.1k↑13.5%5[1 PRs](https://github.com/intaro/twig-injection-bundle/pulls)MITPHPPHP ^8.0

Since Aug 4Pushed 1y ago5 watchersCompare

[ Source](https://github.com/intaro/twig-injection-bundle)[ Packagist](https://packagist.org/packages/intaro/twig-injection-bundle)[ RSS](/packages/intaro-twig-injection-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (13)Used By (0)

TwigInjectionBundle
===================

[](#twiginjectionbundle)

The TwigInjectionBundle allows to inject twig templates through the event behavior.

Installation
------------

[](#installation)

TwigInjectionBundle requires Symfony 3.4 or higher.

Require the bundle in your `composer.json` file:

```
{
    "require": {
        "intaro/twig-injection-bundle": "^2.0"
    }
}
```

Register the bundle in `AppKernel`:

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        //...

        new Intaro\TwigInjectionBundle\IntaroTwigInjectionBundle(),
    ];

    //...
}
```

Install the bundle:

```
$ composer update intaro/twig-injection-bundle

```

Usage
-----

[](#usage)

1. Add `{{ inject() }}` calling in template:

```
{{ inject('twig.injection.event.name', { parameter1: 'some-value', parameter2: some_object }) }}
```

2. Prepare controller action which you want to render or template which you want to include.
3. Define Listener which will inject `include` or `render` calling:

```
