Download the PHP package eminos/statamic-cloudflare-cache without Composer

On this page you can find all versions of the php package eminos/statamic-cloudflare-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-cloudflare-cache

Statamic Cloudflare Cache

Automatically purge your Cloudflare cache when content changes in Statamic.

Features

Installation

You can install the package via composer:

Publish the config file:

Configuration

Basic Setup (Single Zone)

Add the following environment variables to your .env file:

Multi-Zone Setup (Multisite)

For Statamic multisite installations with multiple domains, you can configure multiple Cloudflare zones. The package uses a single API token for all zones.

In your config/cloudflare-cache.php file, add your zone mappings:

The package will automatically detect which zone to use based on the URL being purged. It will:

  1. First try to match the exact domain from the URL
  2. Then try without 'www.' prefix (so 'example.com' will match 'www.example.com')
  3. Fall back to the default zone_id if no match is found

Getting Your Cloudflare Credentials

You can get your API token and Zone IDs from the Cloudflare dashboard:

  1. API Token: Log in to your Cloudflare dashboard, go to "My Profile" > "API Tokens" and create a token with the "Zone.Cache Purge" permission for all zones you want to manage.

  2. Zone ID: Go to your domain's overview page in Cloudflare. The Zone ID is displayed in the right sidebar under "API" section.

Usage

Automatic Cache Purging

Once configured, the addon will automatically purge the Cloudflare cache when content changes in Statamic. By default, it listens for the following events:

You can configure which events trigger cache purging in the config file.

Event handling modes (either/or)

Queued Purging

If 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' => true in the configuration file.

When 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).

Manual Cache Purging

You can manually purge the cache using the following command:

Advanced Configuration

The published configuration file (config/cloudflare-cache.php) allows you to customize the behavior of the addon:

Testing

License

The MIT License (MIT). Please see License File for more information.


All versions of statamic-cloudflare-cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
statamic/cms Version ^5.0|^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eminos/statamic-cloudflare-cache contains the following files

Loading the files please wait ...