2017 © Pedro Peláez
 

library matryoshka

Russian Doll Caching for Laravel.

image

achillesp/matryoshka

Russian Doll Caching for Laravel.

  • Sunday, November 19, 2017
  • by achillesp
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

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., (*1)

Installation

Step 1: Composer

From the command line, run:, (*2)

composer require achillesp/matryoshka

Step 2: Service Provider (Laravel < 5.5)

For your Laravel app, open config/app.php and, within the providers array, append:, (*3)

Achillesp\Matryoshka\MatryoshkaServiceProvider::class

Config

This package uses a config file which you can override by publishing to your config dir., (*4)

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., (*5)

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

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., (*7)

Caching HTML

@cache('my-cache-key')
    <div>
        <h1>Hello World</h1>
    </div>
@endcache

Caching Models

@cache($post)
    <article>
        <h2>{{ $post->title }}></h2>
        <p>Written By: {{ $post->author->username }}</p>

        <div class="body">{{ $post->body }}</div>
    </article>
@endcache

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

use Achillesp\Matryoshka\Cacheable;

class Post extends Eloquent
{
    use Cacheable;
}

Caching Collections

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

License

The MIT License (MIT). Please see License File for more information., (*9)

The Versions

19/11 2017

dev-master

9999999-dev

Russian Doll Caching for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Achilles Panagiotou

laravel cache

31/10 2017

0.2.1

0.2.1.0

Russian Doll Caching for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Achilles Panagiotou

laravel cache

26/10 2017

0.2.0

0.2.0.0

Russian Doll Caching for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Achilles Panagiotou

laravel cache

29/09 2017

0.1.1

0.1.1.0

Russian Doll Caching for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Achilles Panagiotou

laravel cache

27/09 2017

0.1.0

0.1.0.0

Russian Doll Caching for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Achilles Panagiotou

laravel cache