PHPackages                             yfktn/twigcacheplugin - 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. yfktn/twigcacheplugin

ActiveOctober-plugin[Templating &amp; Views](/categories/templating)

yfktn/twigcacheplugin
=====================

October CMS Plugin to add Twig Cache Extension into OctoberCMS.

v0.1.2(4y ago)1151[1 issues](https://github.com/yfktn/twigcache-plugin/issues)MITPHP

Since Apr 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/yfktn/twigcache-plugin)[ Packagist](https://packagist.org/packages/yfktn/twigcacheplugin)[ Docs](https://github.com/yfktn/twigcache-plugin)[ RSS](/packages/yfktn-twigcacheplugin/feed)WikiDiscussions master Synced 6d ago

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

OctoberCMS Plugin to use Twig Cache Extension
=============================================

[](#octobercms-plugin-to-use-twig-cache-extension)

Add [twig cache plugin extension](https://github.com/twigphp/twig-cache-extension) to octoberCMS.

Installing The Plugin
---------------------

[](#installing-the-plugin)

Since v0.0.6 we can installing the plugin from composer. From the root of octobercms path:

```
$ composer require yfktn/twigcacheplugin

```

You need to use version v0.1 for OctoberCMS version 1.1.

How To Use
----------

[](#how-to-use)

This plugin currently implement the `IndexedChainingCacheStrategy()`, with **time** (`LifetimeCacheStrategy()`) and **model** (`GenerationalCacheStrategy()`) as index to access when we need to implement related strategy.

To use it, in your twig template, surround the code with a **cache** block at the part you want to cache.

Let say we have part of our homepage that we need to cache, and it would expired in 120 seconds, then our code would be:

```
{# add homepage annotation with time strategy, for 10 seconds #}
{% cache "homepage" {time: 10} %}
    {# heavy lifting template stuff here, include/render other partials etc #}
{% endcache %}

```

In another case, you have view to show detail of Eloquent database model and it would expired in 7200 seconds or when our model updated (*since the cache strategy need **created\_at** field in your model as Carbon object to generated cache key, you need to make custom mutator if it doesn't exist*), then our code would be:

```
{# add model annotation #}
{% set annotmodel = "model" ~ post.id %}
{% cache annotmodel {model: post} %}
    {# heavy lifting template stuff here, include/render other partials etc #}
{% endcache %}

```

Blackhole Cache Strategy
------------------------

[](#blackhole-cache-strategy)

When you are in development mode, you don't need twig loading previous generated cache to view. In the configuration file you can change value of *blackholeCacheStrategyMode* to true, this strategy prevents previously caching version from being rendered.

**True** is the default value of `blackholeCacheStrategyMode` and **you MUST** set this value to **false** when deploying it in your production server.

For more information about twig cache plugin extension please consult to [twig cache plugin extension](https://github.com/twigphp/twig-cache-extension) page.

Note: My plugin is in early stages of its development, please use with care.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

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

Every ~109 days

Total

5

Last Release

1800d ago

### Community

Maintainers

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

---

Top Contributors

[![yfktn](https://avatars.githubusercontent.com/u/1888139?v=4)](https://github.com/yfktn "yfktn (16 commits)")

### Embed Badge

![Health badge](/badges/yfktn-twigcacheplugin/health.svg)

```
[![Health](https://phpackages.com/badges/yfktn-twigcacheplugin/health.svg)](https://phpackages.com/packages/yfktn-twigcacheplugin)
```

###  Alternatives

[twig/cache-extra

A Twig extension for Symfony Cache

392.1M20](/packages/twig-cache-extra)[emanueleminotto/twig-cache-bundle

Symfony 2 Bundle for twigphp/twig-cache-extension

59678.3k4](/packages/emanueleminotto-twig-cache-bundle)[tales-from-a-dev/twig-tailwind-extra

A Twig extension for Tailwind

34802.1k9](/packages/tales-from-a-dev-twig-tailwind-extra)[odan/twig-assets

Caching and compression for Twig assets (JavaScript and CSS).

2223.0k4](/packages/odan-twig-assets)

PHPackages © 2026

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