Automatically purge your CDN cache when Statamic content changes. Works with Bunny CDN out of the box, but supports any CDN with a purge API.
You can install the package via composer:
composer require jorisnoo/statamic-bunny-purgeAdd your API key to .env:
CDN_PURGE_API_KEY=your-bunny-api-keyThat's it — Bunny CDN is the default and works without any further configuration.
You can publish the config file with:
php artisan vendor:publish --tag="statamic-bunny-purge"This is the contents of the published config file:
return [
'api_url' => env('CDN_PURGE_API_URL', 'https://api.bunny.net/purge'),
'api_key' => env('CDN_PURGE_API_KEY'),
'auth_type' => env('CDN_PURGE_AUTH_TYPE', 'access_key'),
];| Key | Description | Default |
|---|---|---|
api_url |
The CDN purge API endpoint | https://api.bunny.net/purge |
api_key |
Your CDN API key | — |
auth_type |
Auth header style: access_key or bearer |
access_key |
Override the API URL and auth type to point at any CDN purge endpoint:
CDN_PURGE_API_URL=https://cdn.example.com/api/cache/purge
CDN_PURGE_API_KEY=your-api-key
CDN_PURGE_AUTH_TYPE=bearerThe package works automatically. It listens to Statamic's URL invalidation events and purges the corresponding URLs from your CDN cache whenever content changes.
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.