PHPackages                             springtimesoft/silverstripe-cloudflare-assets-purge - 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. springtimesoft/silverstripe-cloudflare-assets-purge

ActiveSilverstripe-vendormodule[Caching](/categories/caching)

springtimesoft/silverstripe-cloudflare-assets-purge
===================================================

Queues a Cloudflare cache purge when Silverstripe assets are published, unpublished, or deleted

1.0.0-beta1(1mo ago)010MITPHP

Since Jul 16Pushed 1w agoCompare

[ Source](https://github.com/springtimesoft/silverstripe-cloudflare-assets-purge)[ Packagist](https://packagist.org/packages/springtimesoft/silverstripe-cloudflare-assets-purge)[ Docs](https://github.com/springtimesoft/silverstripe-cloudflare-assets-purge)[ RSS](/packages/springtimesoft-silverstripe-cloudflare-assets-purge/feed)WikiDiscussions develop Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Silverstripe Cloudflare Assets Purge
====================================

[](#silverstripe-cloudflare-assets-purge)

Automatically purges the Cloudflare cache when Silverstripe assets are published, unpublished, or deleted, and after a `dev/build`.

Requirements
------------

[](#requirements)

- Silverstripe ^5
- [symbiote/silverstripe-queuedjobs](https://github.com/symbiote/silverstripe-queuedjobs) ^5

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

[](#installation)

```
composer require springtimesoft/silverstripe-cloudflare-assets-purge
```

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env`:

```
CLOUDFLARE_PURGE_ZONE_ID="your-zone-id"
CLOUDFLARE_PURGE_API_TOKEN="your-api-token"

```

The API token requires the **Cache Purge** permission on the target zone. [See below](#creating-a-cloudflare-api-key) for instructions on creating a Cloudflare API token (either account level, or using personal access token).

If either variable is absent the module silently does nothing, so it is safe to install in environments where Cloudflare is not configured (e.g. local development).

Additionally, you must have the [queued jobs](https://github.com/symbiote/silverstripe-queuedjobs) module installed, with a cron job configured to process its queue.

How it works
------------

[](#how-it-works)

- **File / Image publish** - queues a full-zone cache purge via `FileCachePurgeExtension::onAfterPublish`.
- **File / Image unpublish** - queues a purge via `FileCachePurgeExtension::onAfterUnpublish`.
- **File / Image delete** - queues a purge only when a live version exists (draft-only files have nothing cached).
- **dev/build** - queues a purge via `DevBuildCachePurgeExtension::onAfterBuild`.

Purges are handled asynchronously by `PurgeWebsiteAssetsJob`, which calls the [Cloudflare Cache Purge API](https://developers.cloudflare.com/api/resources/cache/methods/purge/) with `purge_everything: true`. This flushes the **entire zone cache** - not just assets - so pages, CSS, JS, and any other cached responses will also be invalidated.

Creating a Cloudflare API Key
-----------------------------

[](#creating-a-cloudflare-api-key)

You will need to configure this module with an existing Cloudflare API token. This API token can either be an Account API token, or a personal access token.

### Creating an account API token

[](#creating-an-account-api-token)

1. Log in to your Cloudflare account.
2. Navigate to your account → `Manage account` → `Account API tokens`.
3. Click `Create Token`.
4. Provide a reference token name.
5. Select `Start from scratch`.
6. In the `Edit policy` section, change `Entire account` to `Specified Domains`, and select your domain from the list.
7. In the `Search for permission groups` search for `Cache` and select the `Purge` option.
8. `Token expiration`: No expiration.
9. `Client IP address filtering`: leave blank.
10. Click `Review token`, then `Create token`
11. Make a note of the API token (this will be displayed only once). Note: that the account ID is not the same as the zone ID. You can find your zone ID in the Cloudflare dashboard under `Overview` for your domain (bottom right of page).
12. Add the token to your `.env` file as `CLOUDFLARE_PURGE_API_TOKEN` and the zone ID as `CLOUDFLARE_PURGE_ZONE_ID`.

### Creating a personal access token

[](#creating-a-personal-access-token)

1. Within your Cloudflare account, navigate to `My Profile` → [`API Tokens`](https://dash.cloudflare.com/profile/api-tokens).
2. Select `Create Custom Token`.
3. Provide a reference token name.
4. Under permissions, select `Zone` → `Cache Purge` → `Purge`.
5. Under `Zone Resources`, select `Include` → `Specific zone` and select your domain from the list.
6. Leave the remaining fields blank, and click `Continue to summary`.
7. Click "Create Token" and make a note of the API token (this will be displayed only once).
8. You can find your zone ID in the Cloudflare dashboard under `Overview` for your domain (bottom right of page).
9. Add the token to your `.env` file as `CLOUDFLARE_PURGE_API_TOKEN` and the zone ID as `CLOUDFLARE_PURGE_ZONE_ID`.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance95

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% 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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1463435?v=4)[Ralph Slooten](/maintainers/axllent)[@axllent](https://github.com/axllent)

---

Top Contributors

[![axllent](https://avatars.githubusercontent.com/u/1463435?v=4)](https://github.com/axllent "axllent (10 commits)")[![Sitetools](https://avatars.githubusercontent.com/u/8812656?v=4)](https://github.com/Sitetools "Sitetools (1 commits)")

---

Tags

silverstripesilverstripecachecloudflarecdn

### Embed Badge

![Health badge](/badges/springtimesoft-silverstripe-cloudflare-assets-purge/health.svg)

```
[![Health](https://phpackages.com/badges/springtimesoft-silverstripe-cloudflare-assets-purge/health.svg)](https://phpackages.com/packages/springtimesoft-silverstripe-cloudflare-assets-purge)
```

###  Alternatives

[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

13920.8k](/packages/nexxai-laravel-cfcache)[silverstripe/staticpublishqueue

Static publishing queue to create static versions of pages for enhanced performance and security

44143.0k6](/packages/silverstripe-staticpublishqueue)[steadlane/silverstripe-cloudflare

This module aims to relieve the stress of using Cloudflare caching with any SilverStripe project. Adds extension hooks that clears Cloudflare's cache for a specific page when that page is published or unpublished.

233.7k](/packages/steadlane-silverstripe-cloudflare)[silverstripe-terraformers/keys-for-cache

Silverstripe cache key management

1631.0k](/packages/silverstripe-terraformers-keys-for-cache)

PHPackages © 2026

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