PHPackages                             agallou/twig-hashed-file-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. agallou/twig-hashed-file-extension

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

agallou/twig-hashed-file-extension
==================================

Include file containing content hash in twig templates

0.1.0(10y ago)0588MITPHP

Since Mar 13Pushed 10y ago1 watchersCompare

[ Source](https://github.com/agallou/twig-hashed-file-extension)[ Packagist](https://packagist.org/packages/agallou/twig-hashed-file-extension)[ RSS](/packages/agallou-twig-hashed-file-extension/feed)WikiDiscussions master Synced 2mo ago

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

twig-hashed-file-extension
==========================

[](#twig-hashed-file-extension)

The [grunt-hash](https://www.npmjs.org/package/grunt-hash) [grunt](http://www.gruntjs.com/) plugin allows you to rename files according to their content.

The [robo-hash](https://github.com/agallou/robo-hash) task allows you to to the same in PHP.

For example a file named `main.css` will be renamed to `main.54e79f6f.css`.

So the file is not easy to include in a Twig template (its name will change at every content change).

This plugin adds a twig function called `hashed_file`.

Usage
-----

[](#usage)

You can call it like this :

```
$twig->addExtension(new \Agallou\TwigHashedFileExtension\Extension(__DIR__ . '/web/assets/', null));
```

```

```

It will look for files called `main*.css` in the `web/assets/css` directory and serve it as `/assets/main.54e79f6f.css`.

If no file is found or more than one file is found an exception will be thrown.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

3719d ago

### Community

Maintainers

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

---

Top Contributors

[![agallou](https://avatars.githubusercontent.com/u/320372?v=4)](https://github.com/agallou "agallou (2 commits)")

---

Tags

twighashassets

### Embed Badge

![Health badge](/badges/agallou-twig-hashed-file-extension/health.svg)

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

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91492.0M315](/packages/twig-extra-bundle)[twig/intl-extra

A Twig extension for Intl

36763.2M221](/packages/twig-intl-extra)[rcrowe/twigbridge

Adds the power of Twig to Laravel

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

A Twig extension for Symfony String

22046.0M133](/packages/twig-string-extra)[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)

PHPackages © 2026

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