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

ActiveLibrary[Caching](/categories/caching)

ngockush/laravel-caching-model
==============================

A simple cache library for laravel eloquent model

1.1.0(3y ago)018MITPHPPHP ^7.0|^8.0

Since Jul 8Pushed 3y agoCompare

[ Source](https://github.com/ngockush/laravel-caching-model)[ Packagist](https://packagist.org/packages/ngockush/laravel-caching-model)[ RSS](/packages/ngockush-laravel-caching-model/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

laravel-caching-model
=====================

[](#laravel-caching-model)

- Simple package for caching laravel eloquent model
- Support retrieve model stored in cache store by id (or other primary key)

Usage
=====

[](#usage)

1. Implement Cacheable interface then use HasCache trait:

```
use Hacoidev\CachingModel\Contracts\Cacheable;
use Hacoidev\CachingModel\HasCache;

class Setting extends Model implements Cacheable
{
    use HasCache;

    ...
}
```

2. use `fromCache()` static method to retrieve model data from cache storage

```
$cachedInstance = Setting::fromCache()->find($key);
```

Available methods:
==================

[](#available-methods)

1. public static function primaryCacheKey(): string;

- Return primary key for creating cache key
- Default: id

2. public static function getCacheKey($id): string;

- Return cache key for specific instance with primary key is $id

3. public static function cacheTimeout(): int;

- Return cache timeout

4. public function scopeCacheWithRelation($query);

- Specific relationship will cache together model

```
public function scopeCacheWithRelation($query)
{
    return $query->with('relationship:id);
}
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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.

###  Release Activity

Cadence

Every ~19 days

Total

3

Last Release

1418d ago

PHP version history (2 changes)1.0.0PHP ^7.0

1.1.0PHP ^7.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/70722b82f973db245a6889904a9c35693b5f510eafa08f1585c25d672ce24504?d=identicon)[ngockush](/maintainers/ngockush)

---

Top Contributors

[![hacoidev](https://avatars.githubusercontent.com/u/108921745?v=4)](https://github.com/hacoidev "hacoidev (2 commits)")[![ngockush](https://avatars.githubusercontent.com/u/44048416?v=4)](https://github.com/ngockush "ngockush (1 commits)")

### Embed Badge

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

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.9k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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