Skip to content

itconsultis/laravel-sugar

Repository files navigation

itc/laravel-sugar

build status badge here code coverage badge here code quality badge here

This is a thoroughly-tested collection of components and traits with no external dependencies. It reduces boilerplate code while adhering to SOLID design principles. Its goal is to make working with Laravel sweeter than it already is.

Features

Model caching

Add caching behavior to any Laravel model.

use Illuminate\Database\Eloquent\Model;
use ITC\Laravel\Sugar\Models\Behaviors\Caching as ModelCachingBehavior;

class Car extends Model
{
    use ModelCachingBehavior;
}

$car = Car::findOrFail(123);

// cache the model instance
$car->remember();

// retrieve the cached model instance
$car = Car::recall(123);

// uncache the model instance
$car->forget();

Requirements

  • PHP 7.0 or later
  • Laravel 5.3 or later

Installation

This is a Composer package. Installation is trivial!

composer require itc/laravel-sugar

Getting Help

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published