PHPackages                             khairul/laravel-auto-refresh-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. khairul/laravel-auto-refresh-cache

ActiveLibrary[Caching](/categories/caching)

khairul/laravel-auto-refresh-cache
==================================

Automatically refresh Laravel cache on model save or delete events.

1(10mo ago)351MITPHPPHP &gt;=8.0

Since Aug 12Pushed 10mo agoCompare

[ Source](https://github.com/mdkhairul773islam/laravel-auto-refresh-cache)[ Packagist](https://packagist.org/packages/khairul/laravel-auto-refresh-cache)[ RSS](/packages/khairul-laravel-auto-refresh-cache/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Auto Refresh Cache Package
==================================

[](#laravel-auto-refresh-cache-package)

This package provides an easy way to auto-refresh cache for Laravel models on save/delete actions.

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

[](#installation)

```
composer require khairul/laravel-auto-refresh-cache:dev-main
```

Open config/app.php and add the following line to the providers array:

```
'providers' => [
    // Other service providers...

    Khairul\AutoRefreshCache\AutoRefreshCacheServiceProvider::class,
],
```

Publish Config
--------------

[](#publish-config)

```
php artisan vendor:publish --tag=config --provider="Khairul\AutoRefreshCache\AutoRefreshCacheServiceProvider"
```

Configuration
-------------

[](#configuration)

Add your cache-aware models to `config/auto_refresh_cache.php`:

```
return [
    'models' => [
        App\Models\CancelReason::class,
        App\Models\ProductCategory::class,
    ],
];
```

Usage
-----

[](#usage)

In your model, use the trait and set the cache key:

```
use Khairul\AutoRefreshCache\Traits\AutoRefreshCache;

class CancelReason extends Model
{
    use AutoRefreshCache;

    protected static string $cacheKey = 'cancel_reasons_all';
}
```

Fetch cached data:

```
$cancelReasons = CancelReason::allFromCache();
```

Refresh Cache Manually
----------------------

[](#refresh-cache-manually)

Run this artisan command to refresh all caches:

```
php artisan cache:refresh
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance53

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

327d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22705639?v=4)[Engr. Khairul Islam Tonmoy](/maintainers/mdkhairul773islam)[@mdkhairul773islam](https://github.com/mdkhairul773islam)

---

Top Contributors

[![mdkhairul773islam](https://avatars.githubusercontent.com/u/22705639?v=4)](https://github.com/mdkhairul773islam "mdkhairul773islam (6 commits)")

### Embed Badge

![Health badge](/badges/khairul-laravel-auto-refresh-cache/health.svg)

```
[![Health](https://phpackages.com/badges/khairul-laravel-auto-refresh-cache/health.svg)](https://phpackages.com/packages/khairul-laravel-auto-refresh-cache)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)[illuminate/cache

The Illuminate Cache package.

12937.0M1.8k](/packages/illuminate-cache)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[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.

21111.6k](/packages/iazaran-smart-cache)

PHPackages © 2026

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