Download the PHP package aminshamim/laravel-model-cache without Composer

On this page you can find all versions of the php package aminshamim/laravel-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 laravel-model-cache

Laravel Model Cache

PHP Version Laravel Version

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

Features

Installation

Install via Composer:

Service Provider Registration

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

Publish Configuration

Quick Start

1. Add the Trait to Your Model

2. Start Using Cached Methods

3. Query Builder Integration

Configuration

The package provides extensive configuration options. Here's the default configuration:

bash php artisan vendor:publish --tag=model-cache-config

{prefix}:{model_class}:{primary_key}

model-cache:App\Models\User:123



## Logging

Enable logging in your configuration:

Log messages include:
- Model cached
- Model found in cache
- Model cache forgotten
- Cache errors

## Performance Benefits

1. **Individual Record Access**: Only cache the specific records you need
2. **Reduced Memory Usage**: No need to cache entire query results
3. **Faster Cache Invalidation**: Clear only specific records when they change
4. **Better Cache Hit Rates**: More granular caching leads to better hit rates
5. **Easy Migration**: Option to override `find()` method reduces refactoring effort

## Comparison with Query-Level Caching

| Feature | Query-Level Caching | Model-Level Caching |
|---------|-------------------|-------------------|
| Cache Granularity | Entire query results | Individual records |
| Memory Usage | High (caches all results) | Low (caches only needed records) |
| Cache Invalidation | Clear entire query cache | Clear specific record cache |
| Cache Hit Rate | Lower (specific queries) | Higher (individual records) |
| Performance | Good for repeated queries | Better for individual record access |

## Advanced Usage

### Custom Cache Keys

Override the `getCacheKey` method in your model:

### Conditional Caching

Override the `shouldCache` method:

## Testing

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request

## License

This package is open-sourced software licensed under the [MIT license](LICENSE). 

All versions of laravel-model-cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0
ext-json Version *
ext-redis Version *
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 aminshamim/laravel-model-cache contains the following files

Loading the files please wait ...