Download the PHP package akibeo/kirby-cacher without Composer

On this page you can find all versions of the php package akibeo/kirby-cacher. 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 kirby-cacher

Kirby Cacher

Tests Kirby 5 License MIT

A Cache Manager for the Kirby Panel: stats and a Clear Cache button for the file cache, the Redis pages cache and any named cache namespaces.

Installation

Composer

Download / Git submodule

Copy this repository into site/plugins/kirby-cacher/:

No build step is required. The plugin registers itself as akibeo/cacher and reads its options from the akibeo.cacher namespace.

Upgrading from the in-tree kirby-akibeo-cacher folder

  1. composer require akibeo/kirby-cacher
  2. Delete site/plugins/kirby-akibeo-cacher/ and remove its !/site/plugins/kirby-akibeo-cacher line from .gitignore.
  3. Remove 'akibeo.cacher' => ['useRedis' => …] from your config; the option is ignored.

The plugin id, API routes, site methods and the Panel menu entry are unchanged.

Requirements

Configuration

Nothing is required. To clear the pages cache from Redis, configure Kirby's pages cache as usual:

Kirby prefixes every key with the site's index URL and the cache name, e.g. www.example.com/pages/. The plugin only ever touches keys under that prefix, so one Redis database can be shared between several sites and apps.

Cache namespaces

Plugins and site code often keep their own caches via kirby()->cache('my.namespace'). List them to give each one stats and a Clear button in the Panel:

Each namespace is cleared through kirby()->cache($name)->flush(). A Redis-backed namespace is only cleared when it has a key prefix and Kirby is 5.5 or later.

Warm up

Warming makes real HTTP requests to the site's own URLs, like an anonymous visitor would: Kirby only stores a page in the pages cache when the request carries no session or cookies, so the authenticated Panel request cannot render the pages itself. The server therefore has to be able to reach its own public URL. On a staging site behind HTTP basic auth every request gets a 401 and nothing is cached.

Two consequences of that:

All options are optional:

Pages excluded by Kirby's own cache.pages.ignore option (closure or array of ids) are skipped as well. Drafts are never warmed; listed and unlisted pages are.

Usage

Panel

Open Cache Manager in the Panel menu (admins only; other roles don't see it). It shows the number and size of cached files, the number and memory usage of this site's Redis keys, and one card per declared namespace.

Clear Cache removes everything in Kirby's cache root (except index.html, .gitignore, .gitkeep and .htaccess) and, when cache.pages uses Redis, this site's Redis pages cache.

Warm Up Cache requests every published page in every language so the pages cache is filled before the first visitor arrives. The Panel sends the URLs to the server in batches and shows a progress bar, so large sites do not run into max_execution_time. The button is disabled when the pages cache is off. Failed requests are listed in the result; the others are still warmed.

PHP

Each clear call returns ['success' => bool, 'cleared' => string[], 'errors' => string[]]; warmup() adds 'warmed' => int. A deploy script typically runs cacher()->clear() followed by cacher()->warmup().

API

All routes require a logged-in admin; other roles get a permission error.

Method Route
POST /api/plugin/cacher/clear-cache file cache + Redis pages cache
POST /api/plugin/cacher/clear-namespace/{name} one declared namespace
GET /api/plugin/cacher/stats stats as shown in the Panel
GET /api/plugin/cacher/warmup-urls { urls: string[], batch: int }
POST /api/plugin/cacher/warmup JSON body { urls: string[] }, at most batch of them per request; only URLs from warmup-urls are requested, anything else is reported as an error and never fetched

Why no FLUSHDB?

A Redis database is frequently shared: several sites on one hosting account, or a site next to an intranet or a queue. FLUSHDB deletes all of it. Kirby stores every pages-cache key under a prefix, so deleting by prefix is all a cache button needs. When there is no prefix the plugin refuses to clear rather than guess.

Development

Without REDIS_HOST the Redis tests are skipped. The Redis test database must be empty; the tests refuse to run against one that is not.

License

MIT


All versions of kirby-cacher with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
getkirby/composer-installer Version ^1.2
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 akibeo/kirby-cacher contains the following files

Loading the files please wait ...