Download the PHP package lotestudio/model-cache without Composer

On this page you can find all versions of the php package lotestudio/model-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package model-cache

Laravel Model Cache

Under development! Use at your own risk!

A lightweight, convention-driven caching layer for Laravel Eloquent models. Automatically caches model query results with observer-based invalidation, request-level caching, and Artisan commands for management.

Designed to cache frequently accessed reference data like stores, price lists, categories, and roles. It's ideal for small datasets (under 50 records) that are read often but change rarely, dramatically reducing database queries and improving response times from ~5-10ms to under 1ms.

Use it when: you have lookup tables, reference data, or configuration-like models that are loaded on almost every request and don't change frequently.

Avoid it when: you're dealing with large tables (>100 records), frequently changing data, real-time requirements, or models with heavy JSON fields that consume significant memory.

Best for: Stores, price lists, categories, statuses, roles, and other "dictionary" tables that power your application's dropdowns, filters, and navigation.

Not suitable for: Orders, users, logs, products (if large), or any data that requires up-to-the-second accuracy.

The package includes automatic cache clearing via observers, request-level caching, Artisan commands, and full Eloquent model support — everything stays cached while maintaining Laravel's native behavior.

Features

Requirements

Installation

The package is located at Lotestudio/ModelCache and is auto-discovered via Laravel's service provider registration.

Service Provider

Register the service provider in bootstrap/providers.php (Laravel 12) or config/app.php:

Facade (Optional)

Add to the aliases array in config/app.php:

Configuration

Publish the configuration file:

Model Configuration Options

Option Type Default Description
model string required Full class name of the Eloquent model
key string required Unique cache key identifier
ttl int 86400 Cache TTL in seconds
order_by string — Column to order results by
order_direction string 'asc' Sort direction (asc or desc)
fields array null (all) Specific columns to select
conditions array [] Where clauses [['column', 'operator', value], ...]

Usage

Basic Usage

Dynamic Magic Methods

The __call magic method provides convenient shortcuts:

Helper Functions

Using the Interface (Dependency Injection)

Artisan Commands

Warm Up Cache

Clear Cache

Cache Statistics

Observer-Based Auto-Clear

When auto_clear is enabled in the config, the package automatically registers model observers that clear the relevant cache whenever a model is saved, updated, deleted, or restored.

The service provider checks for a custom observer at App\Observers\{ModelName}Observer before falling back to the generic ModelCacheObserver.

Architecture

Cache Invalidation

Cache is automatically invalidated via model observers when:

Manual invalidation is also available via clear() or the Artisan command.

License

This is internal application code. All rights reserved.


All versions of model-cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lotestudio/model-cache contains the following files

Loading the files please wait ...