Download the PHP package yonkosam/laravel-cached-pagination without Composer

On this page you can find all versions of the php package yonkosam/laravel-cached-pagination. 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-cached-pagination

Laravel Cached Pagination

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A simple, tag-based caching layer for Laravel Eloquent pagination that dramatically improves performance by caching paginated query results. This package extends Laravel's built-in pagination with smart caching capabilities while maintaining full compatibility with existing pagination methods.

Perfect for applications with heavy database queries where pagination results don't change frequently. The package automatically invalidates cache when models are created, updated, or deleted, ensuring data consistency.

โœจ Features

๐Ÿ“ฆ Installation

You can install the package via Composer:

Publish Configuration (Optional)

You can publish the config file with:

This is the contents of the published config file:

๐Ÿš€ Quick Start

1. Add the Trait to Your Model

2. Use Cached Pagination in Your Controllers

๐Ÿ“– Usage

Basic Cached Pagination

Replace Laravel's standard paginate() method with cachedPaginate():

Custom Cache Duration

Specify a custom TTL (Time To Live) in seconds:

Simple Pagination with Cache

For simple pagination (Previous/Next only):

Cursor Pagination with Cache

For cursor-based pagination:

Complex Queries

The package works with any Eloquent query:

Manual Cache Management

Clear cache for a specific model:

โš™๏ธ Configuration

Cache Store Requirements

This package requires a cache store that supports tagging. The following Laravel cache drivers support tags:

Automatic Cache Invalidation

Configure when the cache should be automatically cleared:

Performance Considerations

๐Ÿ”ง Advanced Usage

Custom Cache Keys

The package automatically generates unique cache keys based on:

Cache keys follow this pattern:

Working with Views

In your Blade templates, use cached pagination results exactly like regular pagination:

API Resources

๐Ÿงช Testing

Run the tests with:

Run tests with coverage:

Run static analysis:

๐Ÿ“Š Performance Benchmarks

Performance improvements vary based on query complexity and data size:

Scenario Without Cache With Cache Improvement
Simple pagination (1000 records) ~50ms ~2ms 96% faster
Complex joins (10,000 records) ~200ms ~3ms 98.5% faster
Heavy aggregations ~500ms ~2ms 99.6% faster

Benchmarks performed on a typical LAMP stack with Redis cache

โ“ FAQ

Q: What happens if my cache store doesn't support tags?

A: The package gracefully falls back to regular pagination without caching. No errors will occur.

Q: How do I cache pagination for API endpoints?

A: Use the same methods in your API controllers. The package works seamlessly with API resources and JSON responses.

Q: Can I use this with custom pagination views?

A: Yes! The cached pagination results work exactly like Laravel's default pagination, so custom views will work without modification.

Q: Will this work with Livewire/Alpine.js?

A: Absolutely! The pagination links and AJAX requests will work normally since the underlying pagination structure is unchanged.

Q: How do I debug cache issues?

A: Enable Laravel's query log to see if queries are being cached:

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING for details.

Development Setup

  1. Clone the repository
  2. Install dependencies: composer install
  3. Run tests: composer test
  4. Check code style: composer format

๐Ÿ”’ Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

๐Ÿ“ Changelog

Please see CHANGELOG for more information on what has changed recently.

๐Ÿ‘ฅ Credits

๐Ÿ“„ License

The MIT License (MIT). Please see License File for more information.


โญ If this package helped you, please give it a star on GitHub!


All versions of laravel-cached-pagination with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.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 yonkosam/laravel-cached-pagination contains the following files

Loading the files please wait ...