PHPackages                             farzinft/laravel-model-caching - 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. farzinft/laravel-model-caching

ActiveLibrary[Caching](/categories/caching)

farzinft/laravel-model-caching
==============================

Simple Way Of Caching Laravel Eloquent Query Results

01.1kPHP

Since Jan 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/farzinft/laravel-model-caching)[ Packagist](https://packagist.org/packages/farzinft/laravel-model-caching)[ RSS](/packages/farzinft-laravel-model-caching/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Model Caching
---------------------

[](#laravel-model-caching)

### For Laravel 5.x.x

[](#for-laravel-5xx)

This is a package to cache your eloquent query results.

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

[](#installation)

Require this package in your composer.json and run composer update (or run `composer require farzinft/laravel-model-caching:dev-master` directly):

```
"farzin/laravel-model-caching": "dev-master"

```

You need to publish the config file for this package. This will add the file `config/model-caching.php`, where you can configure this package.

```
$ php artisan vendor:publish --provider="Fthi\ModelCaching\ServiceProvider"

```

Usage
-----

[](#usage)

You just need add your model to model caching construct and write your eloquent queries in a normal way. this package uses Redis for caching results;

Example:

suppose you have a customer model and you wrote a query like this:

without cache:

```
 "$customers = Customer::with('books')->where(['status' => 1])->get()"

```

and you want cache result 50 seconds, change cache\_expire\_time (in second) in model-caching.php or inside your model define a public variable named $cacheExpireTime, then:

with cache:

```
"$customers = (new ModelCaching(new Customer))->with('books')->where(['status' => 1])->get()"

```

when cache time expired results back from database.

just tested on laravel 5.x, maybe it works on other versions, test it :)

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7bd93b593dba197ea128bba25fe750f90163d3a6fd2775be66d0828342fe5f14?d=identicon)[farzinft](/maintainers/farzinft)

---

Top Contributors

[![farzinft](https://avatars.githubusercontent.com/u/20719437?v=4)](https://github.com/farzinft "farzinft (8 commits)")

### Embed Badge

![Health badge](/badges/farzinft-laravel-model-caching/health.svg)

```
[![Health](https://phpackages.com/badges/farzinft-laravel-model-caching/health.svg)](https://phpackages.com/packages/farzinft-laravel-model-caching)
```

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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