jorisnoo/craft-blitz-bunny-purge

Bunny CDN reverse proxy purger for the Blitz Craft CMS plugin.

Maintainers

Package info

github.com/jorisnoo/craft-blitz-bunny-purge

Type:craft-plugin

pkg:composer/jorisnoo/craft-blitz-bunny-purge

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-03-10 04:35 UTC

This package is auto-updated.

Last update: 2026-03-10 04:35:59 UTC


README

A Craft CMS plugin that provides a Bunny CDN reverse proxy purger for the Blitz caching plugin.

When Blitz invalidates cached content, this purger automatically sends purge requests to the Bunny CDN API to clear the corresponding URLs from the CDN cache.

Features

  • Automatic CDN cache purging when content changes
  • Wildcard purging for full site clears (sends site/* instead of enumerating every URL)
  • Batched URL purging (up to 100 URLs per request)
  • Configurable API endpoint and authentication method
  • Environment variable support for all settings

Requirements

  • Craft CMS 4.0+
  • Blitz 4.0+
  • PHP 8.2+

Installation

Install via Composer:

composer require jorisnoo/craft-blitz-bunny-purge

Then go to Settings > Plugins in the Craft control panel and install the plugin.

Configuration

  1. Go to Settings > Blitz in the control panel
  2. Under Reverse Proxy Purger, select Bunny CDN Purger
  3. Configure the settings:
Setting Description Default
API URL The Bunny CDN purge API endpoint https://api.bunny.net/purge
API Key Your Bunny CDN API key
Authentication Type Access Key or Bearer Token Access Key

All settings support environment variables (e.g., $BUNNY_API_KEY).

Environment Variables

Add to your .env file:

BUNNY_API_KEY=your-api-key-here

Then reference it in the control panel as $BUNNY_API_KEY.

Config File

Alternatively, you can configure the purger via config/blitz.php instead of the control panel:

<?php

use craft\helpers\App;
use Noo\CraftBlitzBunnyPurge\BunnyPurger;

return [
    'cachePurgerType' => BunnyPurger::class,
    'cachePurgerSettings' => [
        'apiUrl' => App::env('BUNNY_API_URL') ?: 'https://api.bunny.net/purge',
        'apiKey' => App::env('BUNNY_API_KEY'),
        'authType' => 'access_key', // or 'bearer'
    ],
];

How It Works

Individual URL Purging

When Blitz invalidates specific URLs, the purger sends them to the Bunny CDN API in batches of up to 100 URLs per request:

POST https://api.bunny.net/purge
{"urls": ["https://example.com/page-1", "https://example.com/page-2"]}

Site Purging

When an entire site is purged, the purger sends a wildcard request instead of enumerating every URL:

POST https://api.bunny.net/purge
{"urls": ["https://example.com", "https://example.com/*"]}

Authentication

  • Access Key (default): Sends an AccessKey header
  • Bearer Token: Sends an Authorization: Bearer header

License

MIT