PHPackages                             mrdilbaz/model-cache - 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. mrdilbaz/model-cache

ActiveLibrary[Caching](/categories/caching)

mrdilbaz/model-cache
====================

Easily cache your Laravel's Eloquent models

044PHP

Since Feb 12Pushed 2y agoCompare

[ Source](https://github.com/mehmetresatdilbaz/eloquent-cache)[ Packagist](https://packagist.org/packages/mrdilbaz/model-cache)[ RSS](/packages/mrdilbaz-model-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Eloquent Cache
==============

[](#eloquent-cache)

> Easily cache your Laravel's Eloquent models.

[![Build Status](https://camo.githubusercontent.com/4d04001b11c923999ba2bca32b5628b67f440ac736a70a0b456191d9505ddac4/68747470733a2f2f7472617669732d63692e6f72672f41757468656e74696b43616e6164612f656c6f7175656e742d63616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/AuthentikCanada/eloquent-cache)[![Coverage Status](https://camo.githubusercontent.com/cb3da2ce34a08583ab18e53a385268b37686f48b8b52eeca406639b2c138b656/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f41757468656e74696b43616e6164612f656c6f7175656e742d63616368652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/AuthentikCanada/eloquent-cache?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/b9466617e4c7c17c3451ed57a4378ed60eabc1db9f2487086b83212be6ffc043/68747470733a2f2f706f7365722e707567782e6f72672f61757468656e74696b2f656c6f7175656e742d63616368652f762f737461626c652e737667)](https://packagist.org/packages/authentik/eloquent-cache)[![Total Downloads](https://camo.githubusercontent.com/96441432eccb30558dac59ac35c5cb9828243d43c478148579720b7f47602791/68747470733a2f2f706f7365722e707567782e6f72672f61757468656e74696b2f656c6f7175656e742d63616368652f646f776e6c6f6164732e737667)](https://packagist.org/packages/authentik/eloquent-cache)

Requirements
------------

[](#requirements)

- Added support for php 8 and laravel 10
- PHP &gt;= 8.0
- Laravel 6 / 7 / 8 / 9 / 10

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

[](#installation)

Install via [composer](https://getcomposer.org/) :

`composer require authentik/eloquent-cache`

How it works
------------

[](#how-it-works)

- When Eloquent fetches models, the JSON representations of the model instances are cached.
- Subsequently, when eloquent fetches a model by ID, the cached JSON will be converted back into an instance.

Usage
-----

[](#usage)

Use the `Cacheable` trait in the models you want to cache.

```
