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

ActiveLibrary[Caching](/categories/caching)

aminshamim/laravel-model-cache
==============================

A Laravel package for automatic model caching with performance optimization

v1.0.0(11mo ago)00MITPHPPHP ^8.2

Since Jul 30Pushed 11mo agoCompare

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

READMEChangelogDependencies (7)Versions (2)Used By (0)

Laravel Model Cache
===================

[](#laravel-model-cache)

[![PHP Version](https://camo.githubusercontent.com/c9f64f714c636ba27a3bba6dfd52f98426832db1262747efa54b212d16943651/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c7565)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/fbcc00bb6481a4fd959f225b19c62a0af617cb5b95918a44a66e8b66f424043e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531312e3025374325354531322e302d726564)](https://laravel.com)[![Tests](https://camo.githubusercontent.com/1e3c5ffc95d3078c888f178f4700bb5465634164c3f61d80ad6b7b974be7b6d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d353625323070617373696e672d677265656e)](#testing)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

A high-performance Laravel package for automatic model caching with intelligent performance optimization, comprehensive monitoring, and seamless integration.

Features
--------

[](#features)

- 🚀 **Automatic Model Caching** - Zero-configuration caching with intelligent cache management
- 📊 **Performance Monitoring** - Built-in cache hit/miss tracking and optimization
- 🎯 **Dynamic TTL Adjustment** - Automatic cache expiration based on performance metrics
- 🔧 **Query Builder Integration** - Enhanced Eloquent queries with caching methods
- 🏷️ **Cache Tagging** - Efficient cache invalidation with tag support
- 📦 **Batch Operations** - Optimized multi-model caching and retrieval
- 🛡️ **Error Resilience** - Graceful fallback to database on cache failures
- 🔍 **Comprehensive Logging** - Detailed debugging and monitoring capabilities
- ⚡ **Laravel 11-12 Ready** - Full compatibility with latest Laravel versions

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

[](#installation)

Install via Composer:

```
composer require aminshamim/laravel-model-cache
```

### Service Provider Registration

[](#service-provider-registration)

The package will automatically register itself via Laravel's package discovery. For manual registration, add to `config/app.php`:

```
'providers' => [
    // Other providers...
    AminShamim\LaravelModelCache\ModelCacheServiceProvider::class,
],
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --provider="AminShamim\LaravelModelCache\ModelCacheServiceProvider"
```

Quick Start
-----------

[](#quick-start)

### 1. Add the Trait to Your Model

[](#1-add-the-trait-to-your-model)

```
