PHPackages                             bnomei/kirby3-staticache - 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. [Caching](/categories/caching)
4. /
5. bnomei/kirby3-staticache

AbandonedArchivedKirby-plugin[Caching](/categories/caching)

bnomei/kirby3-staticache
========================

Kirby 3 plugin to cache html output statically on demand with headers

1.2.3(3y ago)3145MITPHPPHP &gt;=7.4.0

Since Apr 7Pushed 3y agoCompare

[ Source](https://github.com/bnomei/kirby3-staticache)[ Packagist](https://packagist.org/packages/bnomei/kirby3-staticache)[ Docs](https://getkirby.com/plugins/getkirby/staticache)[ RSS](/packages/bnomei-kirby3-staticache/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (6)Dependencies (4)Versions (8)Used By (0)

> ARCHIVED since v1.0.0 of official plugin was released on 1/17/23

Kirby3 Staticache
=================

[](#kirby3-staticache)

[![Release](https://camo.githubusercontent.com/2b2088a509059be859a459811c52f5d427835215859542de5f74fbfc22079ecf/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d737461746963616368653f636f6c6f723d616538316666)](https://camo.githubusercontent.com/2b2088a509059be859a459811c52f5d427835215859542de5f74fbfc22079ecf/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d737461746963616368653f636f6c6f723d616538316666)[![Downloads](https://camo.githubusercontent.com/470a4f1bd6346e60b2e504e1811e31d273c5063a5abdf328410cc75974531437/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d737461746963616368653f636f6c6f723d323732383232)](https://camo.githubusercontent.com/470a4f1bd6346e60b2e504e1811e31d273c5063a5abdf328410cc75974531437/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d737461746963616368653f636f6c6f723d323732383232)[![Twitter](https://camo.githubusercontent.com/b90e4b58a887e8ad09ec267628b75199a48522a9e01e88b129e5d2d730dffe50/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f747769747465722f626e6f6d65693f636f6c6f723d363664396566)](https://twitter.com/bnomei)

Kirby 3 plugin to cache html output statically on demand with headers

Commercial Usage
----------------

[](#commercial-usage)

> **Support open source!**
>
> This plugin is free but if you use it in a commercial project please consider to sponsor me or make a donation.
> If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?
>
> Be kind. Share a little. Thanks.
>
> ‐ Bruno

MONEY[Github sponsor](https://github.com/sponsors/bnomei)[Patreon](https://patreon.com/bnomei)[Buy Me a Coffee](https://buymeacoff.ee/bnomei)[Paypal dontation](https://www.paypal.me/bnomei/15)[Hire me](mailto:b@bnomei.com?subject=Kirby)Installation
------------

[](#installation)

- unzip [master.zip](https://github.com/bnomei/kirby3-staticache/archive/master.zip) as folder `site/plugins/kirby3-staticache` or
- `git submodule add https://github.com/bnomei/kirby3-staticache.git site/plugins/kirby3-staticache` or
- `composer require bnomei/kirby3-staticache`

Setup Cache
-----------

[](#setup-cache)

### Cache configuration

[](#cache-configuration)

Staticache is a cache driver that can be activated for the page cache.

**site/config/config.php**

```
return [
  'cache' => [
    'pages' => [
      'active' => true,
      'type' => 'static'
    ]
  ],
  // other options
];
```

You can also use the cache [ignore rules](https://getkirby.com/docs/guide/cache#caching-pages) to skip pages that should not be cached.

**site/config/config.php**

```
return [
  'cache' => [
    'pages' => [
      'active' => true,
      'type' => 'static',
      'ignore' => function ($page) {
        return $page->template()->name() === 'blog';
      }
    ]
  ],
  // other options
];
```

### Cache duration

[](#cache-duration)

Kirby will automatically purge the cache when changes are made in the Panel.

Setup Server
------------

[](#setup-server)

You can use any of the following ways to make the static cache load. Using one of the native server config rules will be a tiny bit faster than PHP. But if you need to preserve the headers sent using PHP is the only easy way to do it.

### PHP

[](#php)

If you installed the plugin with composer you can use a helper method called `staticache()`.

**index.php**

```
