PHPackages                             achillesp/matryoshka - 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. achillesp/matryoshka

ActiveLibrary[Caching](/categories/caching)

achillesp/matryoshka
====================

Russian Doll Caching for Laravel.

0.2.1(8y ago)115MITPHPPHP ^7.0

Since Sep 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/achillesp/matryoshka)[ Packagist](https://packagist.org/packages/achillesp/matryoshka)[ RSS](/packages/achillesp-matryoshka/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Matryoshka
==========

[](#matryoshka)

Matryoshka is a package for Laravel that provides Russian-Doll caching for views. This package is based on a series of laracasts lessons with a few modifications [See Laracasts.com](https://laracasts.com/series/russian-doll-caching-in-laravel).

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

[](#installation)

### Step 1: Composer

[](#step-1-composer)

From the command line, run:

```
composer require achillesp/matryoshka

```

### Step 2: Service Provider (Laravel &lt; 5.5)

[](#step-2-service-provider-laravel--55)

For your Laravel app, open `config/app.php` and, within the `providers` array, append:

```
Achillesp\Matryoshka\MatryoshkaServiceProvider::class

```

### Config

[](#config)

This package uses a config file which you can override by publishing to your config dir.

```
php artisan vendor publish --provider=MatryoshkaServiceProvider --tag=config

```

In the config file you can set the tag that the cache uses. If you can't use a cache that supports tagging, set it to null.

Also in the config file, you can set whether you want to flush caches on your local machine to help with development.

Usage
-----

[](#usage)

To use the plugin, you use the blade directives `@cache` and `@endcache` in your views. The directive needs an identifier, which can be either a unique string, a Model or a Collection.

### Caching HTML

[](#caching-html)

```
@cache('my-cache-key')

        Hello World

@endcache
```

### Caching Models

[](#caching-models)

```
@cache($post)

        {{ $post->title }}>
        Written By: {{ $post->author->username }}

        {{ $post->body }}

@endcache
```

In order to cache a Model, one more step is needed. You need to use the Cacheable trait in your Model.

```
use Achillesp\Matryoshka\Cacheable;

class Post extends Eloquent
{
    use Cacheable;
}
```

### Caching Collections

[](#caching-collections)

```
@cache($posts)
    @foreach ($posts as $post)
        @include ('post')
    @endforeach
@endcache
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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 ~11 days

Total

4

Last Release

3113d ago

### Community

Maintainers

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

---

Top Contributors

[![achillesp](https://avatars.githubusercontent.com/u/5294270?v=4)](https://github.com/achillesp "achillesp (13 commits)")

---

Tags

blade-directivescachelaravellaravel-5-packagephplaravelcache

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/achillesp-matryoshka/health.svg)

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33313.0k](/packages/anahkiasen-flatten)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

1317.7k](/packages/nexxai-laravel-cfcache)[antennaio/laravel-clyde

Image uploads and manipulation for Laravel, a wrapper around Glide

292.6k](/packages/antennaio-laravel-clyde)

PHPackages © 2026

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