Download the PHP package rocketweb/cache-warmer without Composer
On this page you can find all versions of the php package rocketweb/cache-warmer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rocketweb/cache-warmer
More information about rocketweb/cache-warmer
Files in rocketweb/cache-warmer
Package cache-warmer
Short Description Cache Warmer with a Pre-fetch option to validate Fastly Cache response
License MIT
Informations about the package cache-warmer
Cache Warmer (for Fastly CDN)
Info
This library allows for faster Cache Warmup when dealing with CDN (Fastly CDN & Cloudflare supported so far). It uses HEAD request to check for Cache status. If Cache Status is not a HIT, then full page load is executed. By default, the page is parsed for css/js/img elements and all those get requested also!
It supports smart caching, so you are not requesting the same Page/Element over and over again!
Requests run in a rolling window: a fixed number of requests is always in flight, a slow response does not block the
others. Connections are reused (HTTP/2 multiplexing when the server supports it). Every request advertises the same
Accept-Encoding as a browser (br, gzip, ...), so the CDN cache variant real visitors get is the one being warmed.
Requires PHP 8.3+. On PHP 8.4+ pages are parsed with the HTML5 compliant Dom\HTMLDocument parser, on PHP 8.3 it falls
back to DOMDocument.
Installation & Usage
This library can be installed using composer:
Once installed, you can load it up using standard PSR-4 call. Example code:
The output is echoed directly and contains the following information:
Configuration
There are few things that can be configured:
-
you can set how many concurrent requests you want to execute to the server (applies to both Pages & Elements, default 10)
-
You can bypass the CDN Cache result for certain URLs which will force the Page to be loaded & all Elements to be fetched!
-
You can set up Alternative domains to be used when processing Elements on the Page (for example - your media is being served from different domain). You need to set that before calling
->run(): - You can specify custom header & value to be matched against for CDN Caching validation. The validation is done thru
partial match (needle in haystack). You need to pass additional configuration into the
->run()method:
The configuration gets merged together with default values (that support Fastly & Cloudflare):
For example, if you want to include DYNAMIC to be passed as Cached for Cloudflare:
- You can skip loading Elements (js/img/css) and only warm up the pages listed by specifying the 4th argument of
->run()method:
About
This library was developed for internal usage.
All versions of cache-warmer with dependencies
ext-curl Version *
ext-dom Version *