PHPackages                             justbetter/statamic-cloudflare-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. justbetter/statamic-cloudflare-purge

ActiveLibrary[Caching](/categories/caching)

justbetter/statamic-cloudflare-purge
====================================

Addon that hooks into the statamic invalidation process and purges cloudflare caches

2.2.0(1w ago)32.7k↑816.7%[1 PRs](https://github.com/justbetter/statamic-cloudflare-purge/pulls)MITPHPPHP ^8.4CI passing

Since Jun 11Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/justbetter/statamic-cloudflare-purge)[ Packagist](https://packagist.org/packages/justbetter/statamic-cloudflare-purge)[ Docs](https://github.com/justbetter/statamic-cloudflare-purge)[ RSS](/packages/justbetter-statamic-cloudflare-purge/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (18)Versions (9)Used By (0)

[ ![Banner](./art/banner.svg)](https://github.com/justbetter/statamic-cloudflare-purge "JustBetter")Statamic Cloudflare Purge
=========================

[](#statamic-cloudflare-purge)

This addon will hook into your already existing statamic invalidation and purge any pages that have been invalidated from your Cloudflare cache.

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

[](#requirements)

- PHP ^8.3
- Laravel ^12.0
- Statamic ^6.7

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

[](#installation)

```
composer require justbetter/statamic-cloudflare-purge
```

Usage
-----

[](#usage)

You need a Cloudflare API key with the `Zone.Cache Purge` permission, and set it in your `.env`:

```
CLOUDFLARE_API_TOKEN="token_here"
```

You will also have to define the zone of your website:

```
CLOUDFLARE_ZONE="zone_id_here"
```

Finally, enable the package:

```
CLOUDFLARE_PURGING_ENABLED=true
```

If you have a multistore setup with multiple zones, see the [Configuration](#configuration) section.

This package listens to the `UrlInvalidated` event and adds every invalidated URL to a temp file. It also listens to certain events as defined in the config file to flush the whole cache.

Then, when you run the `statamic:cloudflare:purge` command or the `PurgeCloudflareCachesJob` job, these files will get purged from the Cloudflare cache. As such, you should add this to your `routes/console.php` like so:

```
Schedule::job(\JustBetter\StatamicCloudflarePurge\Jobs\PurgeCloudflareCachesJob::class)->everyFiveSeconds()->withoutOverlapping();
```

Note

Be aware of the [rate limits on the API](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits). You're *probably* not going to run into any issues, but it's possible. Especially if you end up calling an everything-purge often and you're on a free plan, or have a lot of sites running on the same Cloudflare account.

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

[](#configuration)

You can publish the config with the following command:

```
php artisan vendor:publish --provider="JustBetter\StatamicCloudflarePurge\StatamicCloudflarePurgeServiceProvider"
```

### Multiple zones

[](#multiple-zones)

Using the configuration file you can define multiple zones. There are 3 ways of defining the zone in your config:

```
// Single zone
'zone' => 'zone_id',
```

```
// Multiple zones based on statamic site handles
'zone' => [
    'default' => 'zone_id_default',
    'french' => 'zone_id_french',
    ...
],
```

```
// Complete freedom with a callback
'zone' => function() {
    return \App\Facades\Custom::getCloudflareZone()
},
```

### Cache flushing

[](#cache-flushing)

You can define any events that will trigger a full cache purge immediately in the config file. By default, these three events have been defined for this purpose:

```
'flush-events' => [
    \Statamic\Events\GlobalSetSaved::class,
    \Statamic\Events\NavSaved::class,
    \Statamic\Events\StaticCacheCleared::class,
],
```

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance91

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 88.6% 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 ~103 days

Total

5

Last Release

11d ago

Major Versions

1.0.1 → 2.0.02026-03-26

PHP version history (3 changes)1.0.0PHP ^8.1

2.0.0PHP ^8.3

2.1.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d00b3f55cd4ae8b8cfb001a644ed6c7a1127a956c24375bcfe16ce12bd89bed?d=identicon)[justbetter](/maintainers/justbetter)

---

Top Contributors

[![Jade-GG](https://avatars.githubusercontent.com/u/32514269?v=4)](https://github.com/Jade-GG "Jade-GG (31 commits)")[![royduin](https://avatars.githubusercontent.com/u/1703233?v=4)](https://github.com/royduin "royduin (2 commits)")[![kevinmeijer97](https://avatars.githubusercontent.com/u/9716909?v=4)](https://github.com/kevinmeijer97 "kevinmeijer97 (1 commits)")[![niekboon](https://avatars.githubusercontent.com/u/81699906?v=4)](https://github.com/niekboon "niekboon (1 commits)")

---

Tags

cachingcloudflarestatamic

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/justbetter-statamic-cloudflare-purge/health.svg)

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

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

137236.2k8](/packages/statamic-rad-pack-runway)[statamic/statamic

Statamic

830182.1k](/packages/statamic-statamic)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3618.3k](/packages/duncanmcclean-statamic-cargo)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.1k](/packages/statamic-cms)[aerni/advanced-seo

Comprehensive SEO addon for Statamic with flexibility in mind

1818.9k](/packages/aerni-advanced-seo)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

23122.2k16](/packages/marcorieser-statamic-livewire)

PHPackages © 2026

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