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

ActiveLibrary[Database &amp; ORM](/categories/database)

authentik/eloquent-cache
========================

Easily cache your Laravel's Eloquent models

1.3.2(3y ago)573.9k↓100%6[1 issues](https://github.com/AuthentikCanada/eloquent-cache/issues)GPL-3.0-onlyPHPPHP &gt;=7.2

Since Aug 15Pushed 3y ago4 watchersCompare

[ Source](https://github.com/AuthentikCanada/eloquent-cache)[ Packagist](https://packagist.org/packages/authentik/eloquent-cache)[ RSS](/packages/authentik-eloquent-cache/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (7)Versions (21)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)

- PHP &gt;= 7.2
- Laravel 6 / 7 / 8

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.

```
