PHPackages                             cooltronicpl/varnishcache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. cooltronicpl/varnishcache

ActiveCraft-plugin[Caching](/categories/caching)

cooltronicpl/varnishcache
=========================

Boost the performance of your site with Cloudflare or Varnish.

3.2.0(1y ago)2328proprietaryPHP

Since Dec 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cooltronicpl/varnishcache)[ Packagist](https://packagist.org/packages/cooltronicpl/varnishcache)[ RSS](/packages/cooltronicpl-varnishcache/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (30)Used By (0)

CDN Cache &amp; Preload Plugin for Craft CMS 4.x &amp; 3.x &amp; 5.x
====================================================================

[](#cdn-cache--preload-plugin-for-craft-cms-4x--3x--5x)

With ❤️ [CoolTRONIC.pl sp. z o.o.](https://cooltronic.pl) presents a caching helper solution written by [Pawel Potacki](https://potacki.com). This plugin generates static HTML files from your dynamic CMS projects and purges the Varnish or/and Cloudflare cache, resulting in faster page load times and improved Core Web Vitals.

[![Icon](resources/black.png#gh-light-mode-only)](resources/black.png#gh-light-mode-only)[![Icon](resources/white.png#gh-dark-mode-only)](resources/white.png#gh-dark-mode-only)

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
    - [Preloading Server Cache from Sitemap](#preloading-server-cache-from-sitemap)
    - [Configuring Varnish Cache](#configuring-varnish-cache)
    - [Using Varnish Cache](#using-varnish-cache)
    - [How to use Cloudflare with this plugin?](#how-to-use-cloudflare-with-this-plugin)
    - [Disabling or Clearing Some URL](#disabling-or-clearing-some-url)
- [FAQ](#faq)
    - [Q: Are all cache files deleted when updating an entry, or only the ones with a relation?](#q-are-all-cache-files-deleted-when-updating-an-entry-or-only-the-ones-with-a-relation)
    - [Q: The installation fails and plugin does not work.](#q-the-installation-fails-and-plugin-does-not-work)
    - [Q: How to set Varnish Server?](#q-how-to-set-varnish-server)
    - [Q: Which branch should I install for my Craft CMS?](#q-which-branch-should-i-install-for-my-craft-cms)
    - [Q: My Preloading CRON failed. What could be the reason?](#q-my-preloading-cron-failed-what-could-be-the-reason)
    - [Q: Some URL Preloading failed?](#q-some-url-preloading-failed)
    - [Q: How to reset Cache?](#q-how-to-reset-cache)
    - [Q: What if the plugin's control panel settings don't match the screenshots?](#q-what-if-the-plugins-control-panel-settings-dont-match-the-screenshots)
- [Support](#support)
- [Contribution](#contribution)
- [License](#license)
- [Changelog](#changelog)

Features
--------

[](#features)

- **Static HTML Generation**: Generates static HTML files from your dynamic CMS projects, improving page load times and Core Web Vitals.
- **Cloudflare Cache Purging**: The plugin clears the Cloudflare cache when you update your content, so your visitors always see the latest version of your website.
- **Varnish Cache Purging**: Purges the Varnish cache, ensuring that your website always serves the most recent version of your files.
- **Caching Helper Solution**: Provides a caching helper solution, making it easy to manage your cache and improve the performance of your website.
- **Preload**: Provides a mechanism to scan sitemaps, which can also be utilized with Varnish and Cloudflare's Purging mechanism to ensure the greatest possible load times for your updated website.

Installation
------------

[](#installation)

To install this plugin, copy the following command to your terminal:

```
# go to project directory
cd /path/to/project
# Then tell Composer to require the plugin
composer require cooltronicpl/varnishcache
# tell Craft to install and enable the plugin
./craft plugin/install varnishcache
./craft plugin/enable varnishcache
```

You can also install the plugin directly from the [Craft CMS plugin store](https://plugins.craftcms.com/varnishcache/).

Usage
-----

[](#usage)

This section provides detailed instructions and examples on how to use the CDN Cache &amp; Preload to static HTML Helper Plugin.

### Preloading Server Cache from Sitemap

[](#preloading-server-cache-from-sitemap)

The preloading of the server cache from the sitemap is initiated once the settings in the plugin options are enabled. The plugin adds the target URLs from the sitemap to a queue for preloading. However, if CraftCMS 4, 3, or 5 is not active, the next iteration of preload may be paused. After the next login to the admin panel, the preload cron will resume. This ensures that all your sites are continuously preloaded in the Varnish Server with PURGE and the static HTML Cache is recreated. For sites with long initial generation times, such as those generating PDFs with your plugin, the preload is initiated on the first website listed in the sitemap.xml. The duration between preloads can be adjusted from the default value of 60 minutes.

### Configuring Varnish Cache

[](#configuring-varnish-cache)

The plugin works out of the box and does not require special cache tags, unless you want to disable Varnish. If DevMode in Craft CMS is enabled, you will need to manually enable the plugin by activating the 'Force On' setting in the plugin. You can also exclude certain URL paths from generating HTML files.

### Using Varnish Cache

[](#using-varnish-cache)

Varnish Cache has a settings page where you can enable or disable it and flush the cache. If the plugin is working correctly, you will see the cached files in the `storage/runtime/varnishcache/` folder. To check the performance improvement, please use the browser inspector. There, you will be able to see the improved loading times.

### How to use Cloudflare with this plugin?

[](#how-to-use-cloudflare-with-this-plugin)

To use Cloudflare with this plugin, you need to enter your Cloudflare account details in the plugin settings. You need the following information:

- Your Cloudflare API Key, which you can find in your \[Cloudflare Account Profile\].
- Your Cloudflare Zone ID, which you can find in your \[Cloudflare dashboard\] under the Overview tab for your domain.
- Your Cloudflare Email Address, which is the email address that you use to log in to your Cloudflare account.

After you enter your Cloudflare account details, you should test the connection to Cloudflare by clicking the “Test Cloudflare connection” button. If the connection is successful, you will see a notice that says “Cloudflare connection successful”. This means that the plugin can communicate with Cloudflare and clear the Cloudflare cache when you clear the Craft CMS cache.

### Disabling or Clearing Some URL

[](#disabling-or-clearing-some-url)

To disable Varnish Cache for a specific page, you can disable this slug in the admin panel or prevent the creation of HTML files for the entire website using REGEX.

```
{% header "Cache-Control: no-cache" %}
{% header "Pragma: no-cache" %}

```

To clear a specific URL with Varnish and some linked HTML files, this is executed by the Craft Job Queue with a delay that you specify as the last argument in the `clearCustomUrlUriTimeout` function.

Example:

```
{{ craft.varnish.clearCustomUrlUriTimeout("test", "https://domain.com/test/",10) }}

```

This command will clear the cache for the URL  after a delay of 10 seconds.

FAQ
---

[](#faq)

### Q: Are all cache files deleted when updating an entry, or only the ones with a relation?

[](#q-are-all-cache-files-deleted-when-updating-an-entry-or-only-the-ones-with-a-relation)

A: Only related cache files will be deleted and sites preloaded via Varnish after an update.

### Q: The installation fails and plugin does not work.

[](#q-the-installation-fails-and-plugin-does-not-work)

A: Make sure that the folder `storage/runtime/varniscache` is created and there are read/write permissions.

### Q: How to set Varnish Server?

[](#q-how-to-set-varnish-server)

A: You can use the vcl file from [our project](https://github.com/cooltronicpl/-ispconfig3-varnish/blob/master/etc/varnish/default.vcl) which contains a modified WordPress Purge mechanism for Craft CMS.

### Q: Which branch should I install for my Craft CMS?

[](#q-which-branch-should-i-install-for-my-craft-cms)

A: From plugin version `3.0` CraftCMS `5.x` is supported. Try to using newest version of plugin for your CraftCMS installation.

The versions since `2.6.0` is suitable for `3`, `4`, and `5.0.0-alpha`. For older releases Craft CMS 3 &amp; 4 since `2.5.0`, before that for Craft CMS 3.x it was used `craft3` branch with versions 1.x, whereas the 2.x branch is for Craft CMS 4. Try to using newest version of plugin for your CraftCMS installation.

### Q: My Preloading CRON failed. What could be the reason?

[](#q-my-preloading-cron-failed-what-could-be-the-reason)

A: The failure could be due to the inaccessibility of the `sitemap.xml` file or poorly formatted entries within it. Please check the `sitemap.xml` file for any potential issues.

### Q: Some URL Preloading failed?

[](#q-some-url-preloading-failed)

A: If some URL preloading is failing, you can try to increase the preload time in the Preloading Tab. If the problem persists, consider disabling the preload for the affected page.

### Q: How to reset Cache?

[](#q-how-to-reset-cache)

A: To reset the cache, navigate to the settings and enable the **Purge all Cache now?** option. Don't forget to click "Save" to apply the changes.

### Q: What if the plugin's control panel settings don't match the screenshots?

[](#q-what-if-the-plugins-control-panel-settings-dont-match-the-screenshots)

A: You might need to clear the Craft CMS Cache. Navigate to the **Utilities** Tab, select **Caches**, and then click on **Clear cache**.

Support
-------

[](#support)

If you encounter any issues or have questions about the plugin, please create an issue in the GitHub repository or contact us directly at .

Contribution
------------

[](#contribution)

We welcome contributions to the CDN Cache &amp; Preload to static HTML Helper plugin. Please read our contribution guidelines and submit your pull requests.

License
-------

[](#license)

This project is licensed under the Craft License. See the [LICENSE.md](https://github.com/cooltronicpl/varnishcache/LICENSE.md) file for details.

Changelog
---------

[](#changelog)

See the [CHANGELOG.md](https://github.com/cooltronicpl/varnishcache/blob/master/CHANGELOG.md) file for a list of changes in each version of the plugin.

---

Copyright © [CoolTRONIC.pl sp. z o.o.](https://cooltronic.pl)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~69 days

Total

28

Last Release

628d ago

Major Versions

1.1.2 → 2.2.22023-06-18

1.1.4 → 2.2.42023-06-21

1.2.0 → 2.3.12023-08-09

1.2.1 → 2.4.02023-12-04

2.7.2 → 3.0.02024-10-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35310568?v=4)[CoolTRONIC.pl Your business partner](/maintainers/cooltronicpl)[@cooltronicpl](https://github.com/cooltronicpl)

---

Top Contributors

[![cooltronicpl](https://avatars.githubusercontent.com/u/35310568?v=4)](https://github.com/cooltronicpl "cooltronicpl (33 commits)")[![potacki-com](https://avatars.githubusercontent.com/u/140613227?v=4)](https://github.com/potacki-com "potacki-com (14 commits)")

---

Tags

preloadcloudflarecraft-pluginPerformance Optimizationvarnish-cachehtml-purgesitemap-warmupcdn-reverse-proxy

### Embed Badge

![Health badge](/badges/cooltronicpl-varnishcache/health.svg)

```
[![Health](https://phpackages.com/badges/cooltronicpl-varnishcache/health.svg)](https://phpackages.com/packages/cooltronicpl-varnishcache)
```

###  Alternatives

[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

155484.7k37](/packages/putyourlightson-craft-blitz)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k60](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.9k](/packages/verbb-comments)[verbb/vizy

A flexible visual editor field for Craft.

4250.4k](/packages/verbb-vizy)[verbb/hyper

A user-friendly links field for Craft.

24147.8k12](/packages/verbb-hyper)[mmikkel/cache-flag

Cold template caches that can be flagged and automatically invalidated.

1730.4k1](/packages/mmikkel-cache-flag)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
