{"id":34870809,"url":"https://github.com/eminos/statamic-cloudflare-cache","last_synced_at":"2026-02-20T12:01:20.564Z","repository":{"id":287384418,"uuid":"964567432","full_name":"eminos/statamic-cloudflare-cache","owner":"eminos","description":"A Statamic addon that automatically purges your Cloudflare cache when content changes.","archived":false,"fork":false,"pushed_at":"2025-10-01T09:32:58.000Z","size":18,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T08:28:59.937Z","etag":null,"topics":["cloudflare","cloudflare-cache","statamic","statamic-addon","statamic-v5"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eminos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-11T12:23:56.000Z","updated_at":"2025-11-04T02:38:11.000Z","dependencies_parsed_at":"2025-04-11T13:37:19.632Z","dependency_job_id":"8ba1bed3-15c9-4477-83bb-70004ef80624","html_url":"https://github.com/eminos/statamic-cloudflare-cache","commit_stats":null,"previous_names":["eminos/statamic-cloudflare-cache"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/eminos/statamic-cloudflare-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminos%2Fstatamic-cloudflare-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminos%2Fstatamic-cloudflare-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminos%2Fstatamic-cloudflare-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminos%2Fstatamic-cloudflare-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eminos","download_url":"https://codeload.github.com/eminos/statamic-cloudflare-cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminos%2Fstatamic-cloudflare-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29650503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","cloudflare-cache","statamic","statamic-addon","statamic-v5"],"created_at":"2025-12-25T23:46:38.516Z","updated_at":"2026-02-20T12:01:20.558Z","avatar_url":"https://github.com/eminos.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Statamic Cloudflare Cache\n\nAutomatically purge your Cloudflare cache when content changes in Statamic.\n\n## Features\n\n- Automatically purges Cloudflare cache when Statamic content changes.\n- **Multi-zone support** for Statamic multisite installations with different domains.\n- Configurable events that trigger cache purging.\n- Optional support for Statamic `static_caching` invalidation rules via `UrlInvalidated`/`StaticCacheCleared` events.\n- Optional queuing of purge jobs for background processing.\n- CLI command for manual cache purging.\n- Simple configuration with backward compatibility.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require eminos/statamic-cloudflare-cache\n```\n\nPublish the config file:\n\n```bash\nphp artisan vendor:publish --tag=\"cloudflare-cache-config\"\n```\n\n## Configuration\n\n### Basic Setup (Single Zone)\n\nAdd the following environment variables to your `.env` file:\n\n```\nCLOUDFLARE_API_TOKEN=your-api-token\nCLOUDFLARE_ZONE_ID=your-zone-id\nCLOUDFLARE_CACHE_ENABLED=true\nCLOUDFLARE_CACHE_QUEUE_PURGE=false # Optional: Set to true to dispatch purges to the queue\nCLOUDFLARE_CACHE_DEBUG=false # Optional: Set to true to log API calls\n```\n\n### Multi-Zone Setup (Multisite)\n\nFor Statamic multisite installations with multiple domains, you can configure multiple Cloudflare zones. The package uses a single API token for all zones.\n\nIn your `config/cloudflare-cache.php` file, add your zone mappings:\n\n```php\n'zones' =\u003e [\n    // Map domains to zone IDs\n    'example.com' =\u003e 'zone_id_123',\n    'example.fr' =\u003e 'zone_id_456',\n],\n```\n\nThe package will automatically detect which zone to use based on the URL being purged. It will:\n1. First try to match the exact domain from the URL\n2. Then try without 'www.' prefix (so 'example.com' will match 'www.example.com')\n3. Fall back to the default `zone_id` if no match is found\n\n### Getting Your Cloudflare Credentials\n\nYou can get your API token and Zone IDs from the Cloudflare dashboard:\n\n1. **API Token**: Log in to your Cloudflare dashboard, go to \"My Profile\" \u003e \"API Tokens\" and create a token with the \"Zone.Cache Purge\" permission for all zones you want to manage.\n\n2. **Zone ID**: Go to your domain's overview page in Cloudflare. The Zone ID is displayed in the right sidebar under \"API\" section.\n\n## Usage\n\n### Automatic Cache Purging\n\nOnce configured, the addon will automatically purge the Cloudflare cache when content changes in Statamic. By default, it listens for the following events:\n\n- Entry saved/deleted\n- Term saved/deleted\n- Asset saved/deleted\n- Global set saved/deleted (purges everything via `purge_everything_fallback`)\n\nYou can configure which events trigger cache purging in the config file.\n\n#### Event handling modes (either/or)\n\n- **Default (`use_statamic_static_cache_invalidation = false`)**: uses this addon’s own content events (`entry_*`, `term_*`, `asset_*`, etc.).\n- **Statamic static cache mode (`use_statamic_static_cache_invalidation = true`)**: uses Statamic Static Cache events (`url_invalidated`, `static_cache_cleared`) and skips the addon’s legacy content events.\n\n#### Queued Purging\n\nIf you prefer to handle cache purging in the background to avoid potential delays during web requests, you can enable queued purging. Set the `CLOUDFLARE_CACHE_QUEUE_PURGE` environment variable to `true` or set `'queue_purge' =\u003e true` in the configuration file.\n\nWhen enabled, purge operations triggered by events will be dispatched as jobs to your application's queue. **Note:** This requires you to have a queue worker running (`php artisan queue:work`).\n\n### Manual Cache Purging\n\nYou can manually purge the cache using the following command:\n\n```bash\n# Purge all cache (all zones if multi-zone is configured)\nphp please cloudflare:purge\n\n# Purge specific URL (automatically detects the correct zone)\nphp please cloudflare:purge --url=https://example.com/specific-page\n\n# Purge specific zone by ID\nphp please cloudflare:purge --zone=zone_id_123\n\n# Purge specific domain (requires multi-zone configuration)\nphp please cloudflare:purge --domain=example.fr\n```\n\n## Advanced Configuration\n\nThe published configuration file (`config/cloudflare-cache.php`) allows you to customize the behavior of the addon:\n\n```php\nreturn [\n    // Enable or disable the addon\n    'enabled' =\u003e env('CLOUDFLARE_CACHE_ENABLED', true),\n    \n    // Cloudflare API credentials\n    'api_token' =\u003e env('CLOUDFLARE_API_TOKEN', ''),\n    \n    // Single zone configuration (backward compatibility)\n    'zone_id' =\u003e env('CLOUDFLARE_ZONE_ID', ''),\n    \n    // Multi-zone configuration for multisite setups\n    'zones' =\u003e [\n        // 'domain.com' =\u003e 'zone_id_here',\n        // 'another-domain.com' =\u003e 'another_zone_id',\n    ],\n    \n    // Configure which events trigger cache purging\n    'purge_on' =\u003e [\n        'entry_saved' =\u003e true,\n        'entry_deleted' =\u003e true,\n        'term_saved' =\u003e true,\n        'term_deleted' =\u003e true,\n        'asset_saved' =\u003e true,\n        'asset_deleted' =\u003e true,\n        'collection_tree_saved' =\u003e true,\n        'nav_tree_saved' =\u003e true,\n        'global_set_saved' =\u003e true,\n        'global_set_deleted' =\u003e true,\n        'url_invalidated' =\u003e true, // Statamic Static Cache: UrlInvalidated event\n        'static_cache_cleared' =\u003e true, // Statamic Static Cache: StaticCacheCleared event\n    ],\n\n    // When enabled, only Statamic Static Cache events are handled (UrlInvalidated/StaticCacheCleared).\n    // Legacy addon content events are skipped in this mode.\n    'use_statamic_static_cache_invalidation' =\u003e env('CLOUDFLARE_CACHE_USE_STATAMIC_STATIC_CACHE_INVALIDATION', false),\n\n    // Dispatch purge jobs to the queue instead of running synchronously\n    'queue_purge' =\u003e env('CLOUDFLARE_CACHE_QUEUE_PURGE', false),\n    \n    // Advanced settings\n    'purge_urls' =\u003e true, // Purge specific URLs if possible\n    'purge_everything_fallback' =\u003e true, // Fallback to purging everything if specific URLs can't be determined\n    'debug' =\u003e env('CLOUDFLARE_CACHE_DEBUG', false), // Log API call attempts when purging\n];\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminos%2Fstatamic-cloudflare-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feminos%2Fstatamic-cloudflare-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminos%2Fstatamic-cloudflare-cache/lists"}