Download the PHP package vormkracht10/laravel-permanent-cache without Composer

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

Laravel Permanent Cache

Total Downloads Tests PHPStan GitHub release (latest by date) Packagist PHP Version Support Latest Version on Packagist

This package aims to provide functionality of using a permanent cache for tasks using heavy Eloquent models, database queries or other long running tasks in your Laravel app. The permanent cache updates itself in the background using a scheduled task or by listening to an event so no users are harmed waiting on a given request.

Its use case is primarily to be used for heavy tasks that should return complex data or HTML for the front-end that does not need to be realtime but still regularly updated. Think about external API calls that take a few seconds to process or other 1+ second tasks.

Installation

You can install the package via composer:

Optionally, publish config files to change the default config:

The default config options:

Usage

All caches you create must be registered to the PermanentCache::caches facade. We recommend putting this in the boot method of your AppServiceProvider.

You can register caches in multiple ways:

Definition of a Permanent Cache

A Permanent Cache could be a task that runs longer than you'd want your users to wait for. That's why you need to run it in the background, updating periodically using the scheduler or when events happen and/or using help of Laravel's queue system.

You can define the cache store and key using a $store property on the class, following the definition: cache-driver:key, for example: redis:a-unique-cache-key:

Caches can listen for events

If you only want to listen for a single event you can type hint the event in the run method:

Listening for multiple events

Permanent Caches can be updated by listening to multiple events using an array on the $events property:

Caches can be updated periodically using the scheduler

Permanent Caches can be updated using the scheduler (while also listening for events) by adding a schedule method or a $expression property with a cron string.

Note that if you decide to listen to events and schedule your cache, you shouldn't try to accept an $event parameter in the run method, because when the schedule runs, this won't be given to you.

Caches can be updated by dispatching on the queue

Permanent Caches can be updated using a dispatch to the queue by implementing Laravel's ShouldQueue interface and (optionally) specifying a queue:

Feature: Cached Blade Components

One super handy feature are "Cached Components", these are Blade Components that could contain a longer running task on which you don't want your users to wait for completing. So you execute the Blade component when needed in the background, using the scheduler, or queue, while optionally listening for events to happen that will cause the permanent cache to update.

When loading your Blade component, it will always use cache instead of executing a long during task:

Manually updating permanent caches

Manually updating a permanent cache is very simple. Just use the static update method. This will automatically run or queue the execution of the task:

Or you can update all caches at once:

Events when updating Permanent Caches

These events get dispatched when a Permanent Cache gets updated:

Console commands

This package contains Artisan commands to optimize DX when implementing Permanent Cache:

Read more on Jobs & Queues

Credits

License

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


All versions of laravel-permanent-cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^10.0|^11.0
laravel/helpers Version ^1.7
lorisleiva/cron-translator Version ^0.4.5
spatie/emoji Version ^4.1
spatie/laravel-package-tools Version ^1.14.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 vormkracht10/laravel-permanent-cache contains the following files

Loading the files please wait ....