PHPackages                             bnomei/kirby3-boost - 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. [Database &amp; ORM](/categories/database)
4. /
5. bnomei/kirby3-boost

AbandonedArchivedKirby-plugin[Database &amp; ORM](/categories/database)

bnomei/kirby3-boost
===================

Boost the speed of Kirby by having content files of files/pages/users cached, with fast lookup based on uuid.

5.0.3(1y ago)512.6k[3 issues](https://github.com/bnomei/kirby3-boost/issues)MITPHPPHP &gt;=8.2.0CI failing

Since Sep 11Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/bnomei/kirby3-boost)[ Packagist](https://packagist.org/packages/bnomei/kirby3-boost)[ RSS](/packages/bnomei-kirby3-boost/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (6)Versions (62)Used By (0)

> ARCHIVED MAY 2025. suggested alternative:

🚀 Kirby Boost
⏱️ up to 3x faster content loading
🎣 fastest page lookup and resolution of relations
===================================================================================================

[](#rocket-kirby-boost-️-up-to-3x-faster-content-loading-fastest-page-lookup-and-resolution-of-relations)

[![Release](https://camo.githubusercontent.com/deed85da972fbb25c7c75e2f01499664febae8e27b9ff1301a4cf63004ef6837/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d626f6f73743f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/deed85da972fbb25c7c75e2f01499664febae8e27b9ff1301a4cf63004ef6837/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d626f6f73743f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)[![Discord](https://camo.githubusercontent.com/36eaef1b06f4996feb7587aa3281dcbd658e57535bc6b5e10110ed108e7a7a03/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f646973636f72642f626e6f6d65693f636f6c6f723d3732383964612669636f6e3d646973636f7264266c6162656c)](https://discordapp.com/users/bnomei)[![Buymecoffee](https://camo.githubusercontent.com/62e55d1129b82bf9c2fd4656451e81ab87a9787e7c9676ca58276532ed9666ee/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f69636f6e2f646f6e6174653f69636f6e3d6275796d6561636f6666656526636f6c6f723d464638313346266c6162656c)](https://www.buymeacoffee.com/bnomei)

Boost the speed of Kirby by having content files of files/pages/users cached, with fast lookup based on uuid.

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

[](#installation)

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

Usecase
-------

[](#usecase)

If you have to process within a single request a lot of page objects (1000+) or if you have a lot of relations between page objects to resolve then consider using this plugin. With less page objects you will probably not gain enough to justify the overhead.

How does this plugin work?
--------------------------

[](#how-does-this-plugin-work)

- It caches all content files and keeps the cache up to date when you add or modify content. This cache will be used when constructing page objects making everything that involves page objects faster (even the Panel).
- It provides a benchmark to help you decide which cachedriver to use.
- It will use Kirby's uuid (unique id) for page objects to create relations that do not break even if the slug or directory of a page object changes.
- It provides a very fast lookup for page objects via id, diruri or the uuid.

Setup
-----

[](#setup)

For each template you want to be cached you need to use a model to add the content cache logic using a trait.

**site/models/default.php**

```
class DefaultPage extends \Kirby\Cms\Page
{
    use \Bnomei\ModelHasBoost;
}
```

> Since in most cases you will be using Kirbys autoloading for the [pagemodels](https://getkirby.com/docs/guide/templates/page-models) your classname needs to end in `Page`. Like `site/models/article.php` and `ArticlePage` or `site/models/blogpost.php` and `BlogpostPage`.

As a last step fill the boost cache in calling the following in a template or controller. You only have to do this once (not on every request).

```
// fill cache
$count = site()->boost();
echo $count . ' Pages have been boosted.';
```

Congratulations! Now your project is boosted.

### User Models

[](#user-models)

Starting with version 1.9 you can also cache the content files of user models using the respective traits/extends in your custom models via a custom plugin.

```
class AdminUser extends \Kirby\Cms\User
{
    use \Bnomei\ModelHasBoost;
}

Kirby::plugin('myplugin/user', [
    'userModels' => [
        'admin' => AdminUser::class, // admin is default role
    ],
]);
```

### File Models

[](#file-models)

Starting with version 2.0 the plugin to monkey patch the core `Files` class with content cache support. You can only turn this on or off for all files at once since Kirby does not allow custom File models. It would need to read content file first which would defeat the purpose for a content cache anyway.

**site/config/config.php**

```
