PHPackages                             brewdigital/statamic-cloudflare-addon - 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. brewdigital/statamic-cloudflare-addon

ActiveLibrary[Caching](/categories/caching)

brewdigital/statamic-cloudflare-addon
=====================================

1.0.0(1y ago)00MITPHPPHP ^8.0

Since Feb 4Pushed 1y agoCompare

[ Source](https://github.com/brewdigital/statamic-cloudflare-addon)[ Packagist](https://packagist.org/packages/brewdigital/statamic-cloudflare-addon)[ RSS](/packages/brewdigital-statamic-cloudflare-addon/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Cloudflare Integration for Statamic
===================================

[](#cloudflare-integration-for-statamic)

Cloudflare integration for Statamic with CLI, static caching integration, and control panel integration.

Inspired by [HandmadeWeb/statamic-cloudflare](https://github.com/HandmadeWeb/statamic-cloudflare)

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

[](#requirements)

- Statamic 5.0.0 or higher

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

[](#installation)

You can install the package via composer:

```
composer require brewdigital/statamic-cloudflare-addon
```

#### Copy the package config to your local config with the publish command:

[](#copy-the-package-config-to-your-local-config-with-the-publish-command)

The configuration file will not be published automatically to avoid overwrites. You can publish the configuration file using the following command:

```
php artisan vendor:publish --provider="BrewDigital\StatamicCloudflareAddon\ServiceProvider"
```

The configuration file can be modified from `/cp/utilities/cloudflare/settings`.

Usage
-----

[](#usage)

Update Settings: [![Update Settings](assets/images/settings.png)](assets/images/settings.png)Purge collections per zone: [![Purge Collection Per Zone](assets/images/purge_collection_per_zone.png)](assets/images/purge_collection_per_zone.png)Purge url per zone: [![Purge Url Per Zone](assets/images/purge_url_per_zone.png)](assets/images/purge_url_per_zone.png)Purge options: [![Purge Options](assets/images/purge_options.png)](assets/images/purge_options.png)

### CLI

[](#cli)

You can purge everything via the following command:

```
php artisan cloudflare:cache:purge:everything
```

### Static Caching

[](#static-caching)

If you want to use `statamic-cloudflare` as a static cache strategy, then you will need to manually register the cacher in the register method of your `App\Providers\AppServiceProvider` class:

```
/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    \BrewDigital\StatamicCloudflareAddon\Cloudflare::registerCacher();
}
```

Then update your `static_cache` config:

```
'strategies' => [

    'half' => [
        'driver' => 'application',
        'expiry' => null,
    ],

    'full' => [
        'driver' => 'file',
        'path' => public_path('static'),
        'lock_hold_length' => 0,
    ],

    'cloudflare' => [
        'driver' => 'cloudflare',
        'strategy' => 'null',
    ],
],
```

Then update the `static_cache` strategy at the top of the configuration to:

```
'strategy' => 'cloudflare',
```

Currently, the Cloudflare integration is only used for purging. If you would like to use another caching strategy in combination with this caching strategy, then you are free to do that.

This can be done by updating the `strategy` section within the `cloudflare` strategy. Below is an example where we will be caching the application using the [half measure](https://statamic.dev/static-caching#application-driver):

```
'cloudflare' => [
    'driver' => 'cloudflare',
    'strategy' => 'half',
],
```

In theory, you should be able to use any caching strategy here, such as the [full measure](https://statamic.dev/static-caching#file-driver) or any other first or third-party strategies. `statamic-cloudflare` will simply pass requests to the defined strategy and will just hook into the purge actions to also purge the page in Cloudflare.

### Control Panel

[](#control-panel)

#### Events

[](#events)

`statamic-cloudflare` will listen to the `Statamic\Events\EntrySaved`, `Statamic\Events\EntryDeleted`, `Statamic\Events\TermSaved`, and `Statamic\Events\TermDeleted` events and will trigger a purge for the URL. These events will be ignored if you have configured the `static cache` to be a strategy that uses the `cloudflare` driver, as the driver will instead handle the needed purging actions.

#### Utility

[](#utility)

`statamic-cloudflare` will add a utility and a nav item to your Statamic CP.

Route: `/cp/utilities/cloudflare/settings`

This will be available to `Super Users` and the `Cloudflare Manager` and `Manage Brew Cloudflare Settings` are available to be assigned to any role.

You can purge everything quickly by navigating through the purging tabs.

By following these instructions and updating your `composer.json`, you ensure that the Cloudflare addon's configuration file is automatically published after installation or updates.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance42

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

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

468d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd16e7d0ecee84275e8c5cc61c0134dfd523c314527c39f7092c6796d4b2ded8?d=identicon)[brew](/maintainers/brew)

---

Top Contributors

[![brew-cristian](https://avatars.githubusercontent.com/u/119941211?v=4)](https://github.com/brew-cristian "brew-cristian (1 commits)")

---

Tags

cloudflarestatamicStatamic addonstatamic-pluginstatamic-cache

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brewdigital-statamic-cloudflare-addon/health.svg)

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

###  Alternatives

[yediyuz/laravel-cloudflare-cache

laravel-cloudflare-cache

28239.2k](/packages/yediyuz-laravel-cloudflare-cache)[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

1317.7k](/packages/nexxai-laravel-cfcache)[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.

243.7k](/packages/steadlane-silverstripe-cloudflare)

PHPackages © 2026

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