PHPackages                             troopers/assetic-injector-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. troopers/assetic-injector-bundle

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

troopers/assetic-injector-bundle
================================

This bundle allow you to define global javascripts and stylesheets

1.1.3(8y ago)2025.2k↑250%9[2 issues](https://github.com/Troopers/AsseticInjectorBundle/issues)1MITPHPPHP &gt;=5.3.2

Since Jan 31Pushed 8y ago6 watchersCompare

[ Source](https://github.com/Troopers/AsseticInjectorBundle)[ Packagist](https://packagist.org/packages/troopers/assetic-injector-bundle)[ Docs](http://troopers.agency)[ RSS](/packages/troopers-assetic-injector-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (7)Used By (1)

[![Troopers](https://cloud.githubusercontent.com/assets/618536/18787530/83cf424e-81a3-11e6-8f66-cde3ec5fa82a.png)](http://troopers.agency/?utm_source=AsseticInjectorBundle&utm_medium=github&utm_campaign=OpenSource)

[![License](https://camo.githubusercontent.com/6eeab7de6a4158a456d0638e845e6a5928a626395d53824ecd5de0be8eb7a6eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74726f6f706572732f617373657469632d696e6a6563746f722d62756e646c652e737667)](https://packagist.org/packages/troopers/assetic-injector-bundle)[![Version](https://camo.githubusercontent.com/6793936a3b738b038508a71d97e95a6a962207f40c519211f90e6057ae390b30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74726f6f706572732f617373657469632d696e6a6563746f722d62756e646c652e737667)](https://packagist.org/packages/troopers/assetic-injector-bundle)[![Packagist DL](https://camo.githubusercontent.com/a7a3a6706048a9aac953837baee6141e2b19845b993975228ec504f0fca514c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74726f6f706572732f617373657469632d696e6a6563746f722d62756e646c652e737667)](https://packagist.org/packages/troopers/assetic-injector-bundle)[![SensioLabsInsight](https://camo.githubusercontent.com/8e3a0db916139bd7c93c9d1b49c2d948d74acc25f5b492cec1e6dabec4e057c4/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64313065316538652d386264352d343632652d393934662d3431396263666237646137382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d10e1e8e-8bd5-462e-994f-419bcfb7da78)[![Twitter Follow](https://camo.githubusercontent.com/59166962fed540cd620e598de1fd574503100e00b4bd601804f7ae222378f173/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f74726f6f706572736167656e63792e7376673f7374796c653d736f6369616c266c6162656c3d466f6c6c6f7725323054726f6f70657273)](https://twitter.com/troopersagency)

=============

AsseticInjectorBundle
=====================

[](#asseticinjectorbundle)

Description
-----------

[](#description)

The AsseticInjectorBundle allows you to automatically include javascripts and stylesheets anywhere in your project.

This bundle will scan every registered bundles and search for an **assetic\_injector.json file**. From this file, the injector will collect the resources and inject them into the assetic engine. To include them, you have to define a tag (foot, head, custom, ... actually the one you choose) and add the tag in the wanted assetic block.

Install
-------

[](#install)

With Composer :

Add this line in your composer.json file :

```
"troopers/assetic-injector-bundle": "~1.0"

```

Declare the bundle in your AppKernel.php:

```
public function registerBundles() {
    $bundles = array(
        [...]
        new Troopers\AsseticInjectorBundle\TroopersAsseticInjectorBundle(),
        [...]

```

How it works
------------

[](#how-it-works)

.. **Declare** an assetic\_injector.json in the Resource/config folder of your application or bundle.

Within this file, list all the tags and the correspondant resource to inject :

```
{
    "require_all":
    {
        "javascripts":
        {
            "head": "@MyBundle/Resources/public/js/myscript.js"
        },
        "stylesheets":
        {
            "head": "@MyBundle/Resources/public/css/mystyle.css"
        }
    }
}

```

.. **Include** the correspondant tag in your assetic's block with the code : **injector="tag"**

i.e :

```
    {% javascripts injector="head"
        '@MyAcmeDemoBundle/Resources/public/jsloremipsumdolorsitamet.js'
     %}

    {% endjavascripts %}

```

.. **Results**

The resource associated to the tag is injected with assetic\_injector.json.

i.e :

```
    {% javascripts injector="head"
        '@MyAcmeDemoBundle/Resources/public/jsloremipsumdolorsitamet.js'
        '@MyBundle/Resources/public/js/myscript.js'
     %}

    {% endjavascripts %}

```

Enjoy !
-------

[](#enjoy-)

No more needs to include javascript or stylesheets from assetic injector's ready bundles ! Just add the tag and here you are !

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 55% 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 ~120 days

Total

5

Last Release

3280d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/618536?v=4)[Leny BERNARD](/maintainers/lenybernard)[@lenybernard](https://github.com/lenybernard)

---

Top Contributors

[![paulandrieux](https://avatars.githubusercontent.com/u/1942078?v=4)](https://github.com/paulandrieux "paulandrieux (11 commits)")[![lenybernard](https://avatars.githubusercontent.com/u/618536?v=4)](https://github.com/lenybernard "lenybernard (5 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![delormejonathan](https://avatars.githubusercontent.com/u/5949870?v=4)](https://github.com/delormejonathan "delormejonathan (1 commits)")[![sanpii](https://avatars.githubusercontent.com/u/113045?v=4)](https://github.com/sanpii "sanpii (1 commits)")[![webberig](https://avatars.githubusercontent.com/u/3446164?v=4)](https://github.com/webberig "webberig (1 commits)")

---

Tags

asseticinjector

### Embed Badge

![Health badge](/badges/troopers-assetic-injector-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/troopers-assetic-injector-bundle/health.svg)](https://phpackages.com/packages/troopers-assetic-injector-bundle)
```

###  Alternatives

[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22918.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21914.8M162](/packages/symfony-ux-twig-component)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)[symfony/ux-live-component

Live components for Symfony

1635.6M72](/packages/symfony-ux-live-component)[twig/html-extra

A Twig extension for HTML

787.6M41](/packages/twig-html-extra)

PHPackages © 2026

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