Download the PHP package springtimesoft/silverstripe-cloudflare-assets-purge without Composer

On this page you can find all versions of the php package springtimesoft/silverstripe-cloudflare-assets-purge. 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 silverstripe-cloudflare-assets-purge

Silverstripe Cloudflare Assets Purge

Automatically purges the Cloudflare cache when Silverstripe assets are published, unpublished, or deleted, and after a dev/build.

Requirements

Installation

Configuration

Add the following environment variables to your .env:

The API token requires the Cache Purge permission on the target zone. See below for instructions on creating a Cloudflare API token (either account level, or using personal access token).

If either variable is absent the module silently does nothing, so it is safe to install in environments where Cloudflare is not configured (e.g. local development).

Additionally, you must have the queued jobs module installed, with a cron job configured to process its queue.

How it works

Purges are handled asynchronously by PurgeWebsiteAssetsJob, which calls the Cloudflare Cache Purge API with purge_everything: true. This flushes the entire zone cache - not just assets - so pages, CSS, JS, and any other cached responses will also be invalidated.

Creating a Cloudflare API Key

You will need to configure this module with an existing Cloudflare API token. This API token can either be an Account API token, or a personal access token.

Creating an account API token

  1. Log in to your Cloudflare account.
  2. Navigate to your account → Manage account → Account API tokens.
  3. Click Create Token.
  4. Provide a reference token name.
  5. Select Start from scratch.
  6. In the Edit policy section, change Entire account to Specified Domains, and select your domain from the list.
  7. In the Search for permission groups search for Cache and select the Purge option.
  8. Token expiration: No expiration.
  9. Client IP address filtering: leave blank.
  10. Click Review token, then Create token
  11. Make a note of the API token (this will be displayed only once). Note: that the account ID is not the same as the zone ID. You can find your zone ID in the Cloudflare dashboard under Overview for your domain (bottom right of page).
  12. Add the token to your .env file as CLOUDFLARE_PURGE_API_TOKEN and the zone ID as CLOUDFLARE_PURGE_ZONE_ID.

Creating a personal access token

  1. Within your Cloudflare account, navigate to My Profile → API Tokens.
  2. Select Create Custom Token.
  3. Provide a reference token name.
  4. Under permissions, select Zone → Cache Purge → Purge.
  5. Under Zone Resources, select Include → Specific zone and select your domain from the list.
  6. Leave the remaining fields blank, and click Continue to summary.
  7. Click "Create Token" and make a note of the API token (this will be displayed only once).
  8. You can find your zone ID in the Cloudflare dashboard under Overview for your domain (bottom right of page).
  9. Add the token to your .env file as CLOUDFLARE_PURGE_API_TOKEN and the zone ID as CLOUDFLARE_PURGE_ZONE_ID.

License

MIT License. See LICENSE for details.


All versions of silverstripe-cloudflare-assets-purge with dependencies

PHP Build Version
Package Version
Requires ext-curl Version *
silverstripe/framework Version ^6
symbiote/silverstripe-queuedjobs Version ^6
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 springtimesoft/silverstripe-cloudflare-assets-purge contains the following files

Loading the files please wait ...