PHPackages                             setono/twig-cache-purger-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. setono/twig-cache-purger-bundle

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

setono/twig-cache-purger-bundle
===============================

A Symfony bundle that allows you to purge single templates in the Twig cache

v1.1.0(2mo ago)026.3k↓10.1%1MITPHPPHP &gt;=8.1CI passing

Since Jun 7Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Setono/TwigCachePurgerBundle)[ Packagist](https://packagist.org/packages/setono/twig-cache-purger-bundle)[ RSS](/packages/setono-twig-cache-purger-bundle/feed)WikiDiscussions master Synced 3d ago

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

Twig Cache Purger Bundle
========================

[](#twig-cache-purger-bundle)

[![Latest Version](https://camo.githubusercontent.com/53fc4df2749752b8df9df32f032714fcdf6dfef5ee46edab4339e64f3daf09c6/68747470733a2f2f706f7365722e707567782e6f72672f7365746f6e6f2f747769672d63616368652d7075726765722d62756e646c652f762f737461626c65)](https://packagist.org/packages/setono/twig-cache-purger-bundle)[![Software License](https://camo.githubusercontent.com/fbc840fb6a55ef0e6dc1ae55d7acc17041377c20e011a807a38eb4229c11fcf5/68747470733a2f2f706f7365722e707567782e6f72672f7365746f6e6f2f747769672d63616368652d7075726765722d62756e646c652f6c6963656e7365)](LICENSE)[![build](https://github.com/Setono/TwigCachePurgerBundle/actions/workflows/build.yaml/badge.svg)](https://github.com/Setono/TwigCachePurgerBundle/actions/workflows/build.yaml)[![codecov](https://camo.githubusercontent.com/de2cd5c24608b2abc6847224c6a84270e9d64f26a76e7cc8948f3335228e3c05/68747470733a2f2f636f6465636f762e696f2f67682f5365746f6e6f2f54776967436163686550757267657242756e646c652f67726170682f62616467652e7376673f746f6b656e3d366b57507769416c424b)](https://codecov.io/gh/Setono/TwigCachePurgerBundle)

Purge the cache for individual Twig template files instead of removing the whole cache directory.

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

[](#requirements)

- PHP 8.2+
- Symfony 6.0/7.0/8.0
- Twig 2.x or 3.x

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

[](#installation)

```
composer require setono/twig-cache-purger-bundle
```

This will install the bundle and enable it if you're using Symfony Flex. If you're not using Flex, add the bundle manually to `bundles.php`:

```
Setono\TwigCachePurgerBundle\SetonoTwigCachePurgerBundle::class => ['all' => true],
```

Usage
-----

[](#usage)

The bundle provides a `PurgerInterface` service that you can inject into your services to purge individual Twig template cache files by their logical template name:

```
use Setono\TwigCachePurgerBundle\Purger\PurgerInterface;

final class YourService
{
    public function __construct(private readonly PurgerInterface $purger)
    {
    }

    public function updateTemplate(): void
    {
        // Purge the cached compiled version of a specific template
        $this->purger->purge('emails/welcome.html.twig');
    }
}
```

The purger resolves the logical template name to its compiled cache file, invalidates the opcache/APC bytecode cache, and deletes the file. The next time the template is rendered, Twig will recompile it from the source.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance84

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~1406 days

Total

2

Last Release

83d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2412177?v=4)[Joachim Løvgaard](/maintainers/loevgaard)[@loevgaard](https://github.com/loevgaard)

---

Top Contributors

[![loevgaard](https://avatars.githubusercontent.com/u/2412177?v=4)](https://github.com/loevgaard "loevgaard (21 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/setono-twig-cache-purger-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/setono-twig-cache-purger-bundle/health.svg)](https://phpackages.com/packages/setono-twig-cache-purger-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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