PHPackages                             brieucthomas/elixir-twig-extension - 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. brieucthomas/elixir-twig-extension

ActiveLibrary[Templating &amp; Views](/categories/templating)

brieucthomas/elixir-twig-extension
==================================

Laravel Elixir twig extension

v1.0.0(9y ago)112.1k—8.6%7MITPHPPHP &gt;=5.5.9

Since Dec 6Pushed 9y ago1 watchersCompare

[ Source](https://github.com/brieucthomas/elixir-twig-extension)[ Packagist](https://packagist.org/packages/brieucthomas/elixir-twig-extension)[ RSS](/packages/brieucthomas-elixir-twig-extension/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Laravel Elixir Twig Extension
=============================

[](#laravel-elixir-twig-extension)

[![Build Status](https://camo.githubusercontent.com/402d11a3b0c6d3af76a218803291006a55086a437a1eb9f46c7a9910eab743ed/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62726965756374686f6d61732f656c697869722d747769672d657874656e73696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/brieucthomas/elixir-twig-extension)

The Laravel Elixir `version` task appends a unique hash to filename, allowing for cache-busting.

```
elixir(function(mix) {
    mix.version("css/all.css");
});
```

For example, the generated file name will look something like: `all-16d570a7.css`.

In Laravel, you can use in your views the `elixir()` function to load the appropriately hashed asset:

```

```

This twig extension is an adaptation of this `elixir()` function.

Requirements
------------

[](#requirements)

You need PHP &gt;= 5.5.9 to use the library, but the latest stable version of PHP is recommended.

Install
-------

[](#install)

Install using Composer:

```
composer require brieucthomas/elixir-twig-extension
```

This will edit (or create) your composer.json file and automatically choose the most recent version.

Documentation
-------------

[](#documentation)

### Register the extension

[](#register-the-extension)

```
use BrieucThomas\Twig\Extension\ElixirExtension;

$elixir = new ElixirExtension(
    $publicDir,     // the absolute public directory
    $buildDir,      // the elixir build directory (default value is 'build')
    $manifestName   // the manifest filename (default value is 'rev-manifest.json')
);
$twig->addExtension($elixir);
```

### Register the extension as a Symfony Service

[](#register-the-extension-as-a-symfony-service)

```
# app/config/services.yml
services:
    app.twig_elixir_extension:
        class: BrieucThomas\Twig\Extension\ElixirExtension
        arguments: ["%kernel.root_dir%/../web/"]
        public: false
        tags:
            - { name: twig.extension }
```

### Create a gulpfile

[](#create-a-gulpfile)

Here an example of `gulpfile.js` to compile and version the script `app/Resources/js/app.js` :

```
// gulpfile.js
const elixir = require('laravel-elixir');

elixir.config.assetsPath = 'app/Resources';
elixir.config.publicPath = 'web';
elixir.config.appPath = 'src';
elixir.config.viewPath = 'app/Resources/views';

elixir(function(mix) {
    // compile scripts to web/js/all.js (default output)
    mix.scripts(['app.js']);

    // version compiled scripts
    mix.version(['js/all.js']);
});
```

### Using the Extension

[](#using-the-extension)

```

```

You can surround with the `asset` twig extension to make your application more portable:

```

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3498d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/50e55032988467253880977dbf911cc465bfb11b425b1c6de6994b7dc024f959?d=identicon)[Brieucthomas](/maintainers/Brieucthomas)

---

Top Contributors

[![brieucthomas](https://avatars.githubusercontent.com/u/3427873?v=4)](https://github.com/brieucthomas "brieucthomas (10 commits)")

---

Tags

phptwigtwig-extensionphpsymfonylaraveltwigextension

### Embed Badge

![Health badge](/badges/brieucthomas-elixir-twig-extension/health.svg)

```
[![Health](https://phpackages.com/badges/brieucthomas-elixir-twig-extension/health.svg)](https://phpackages.com/packages/brieucthomas-elixir-twig-extension)
```

###  Alternatives

[symfony/ux-live-component

Live components for Symfony

1647.0M128](/packages/symfony-ux-live-component)[tales-from-a-dev/twig-tailwind-extra

A Twig extension for Tailwind

361.1M13](/packages/tales-from-a-dev-twig-tailwind-extra)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

262.6k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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