Download the PHP package catalyst.net.nz/silverstripe-cloudflare without Composer

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

silverstripe-cloudflare

Build Status Latest Stable Version Total Downloads License Monthly Downloads Code Climate

Introduction

The intention of this module is to relieve the double-handling required when updating any of your pages within the CMS of SilverStripe while being behind Cloudflare. When a page is Published or Unpublished a call will be made to the relevant Cloudflare endpoint to clear the cache of the URL/Page you just published/unpublished.

This allows you to see your changes instantly in the preview window without having to worry about logging into the Cloud Flare dashboard to purge the cache yourself.

Cloudflare allows you to have multiple domains registered under a single account. This module is versatile in the sense that it will automatically detect which Zone ID is to be used alongside the domain that this module is installed on. Therefore beyond the two configuration settings required below there is no additional setup required. You can "plug and play" this module in as many locations as you want which means you don't have to worry about tracking down the relevant Zone ID (you can only get it via the API).

Remember: Always keep your API authentication details secure. If you are concerned with your credentials being on someone else's machine; have them set up their own Cloudflare account.

Note: The detected Zone ID will always be shown in the SilverStripe Administration panel whilst viewing the "Cloudflare" menu item. To bypass this, set CLOUDFLARE_ZONE_ID as an environment variable, obtained from the Cloudflare dashboard

Why is this module forked?

This module is a fork of the original SteadLane module, which was written for Silverstripe 3 and featured on the Silverstripe blog. The parent repository was upgraded to Silverstripe 4, but necessary changes needed to make the module work for Silverstripe 5 are not being reviewed or accepted. This has led to numerous forks being maintained by community members, which makes it difficult to track and check out with Composer. In addition, the Cloudflare API itself has evolved somewhat, leading to a fairly significant rewrite.

The repository is hosted here, to support our own client work and enable others to continue providing contributions.

Features

Unlike the original module, this version deliberately avoids the purge_everything action. It is more appropriate to use Cloudflare's Dashboard if this functionality is required.

Subsites

This module has not been tested extensively with subsites, but it should work. One gotcha: if your application relies on Apache's $_SERVER['DOCUMENT_ROOT'] variable this probably isn't to work for you - the purge call relies on AbsoluteLink() now. If raising a issue or bug for subsites, please provides details and tests.

Installation

This module only supports installation via Composer:

For Silverstripe 5.3+, use the 3.0.0 tag. For older versions, use the older tags: issues raised for these older versions are unlikely to be fixed.

Run /dev/build afterwards and ?flush=1 for good measure for SilverStripe to become aware of this module

Configuration

You're going to need an API key issued by Cloudflare for your zone.

  1. Login to Cloudflare. Go to Profile > API Tokens > Create Token
  2. You need to issue a token called "Cache Purges" with "Zone.Zone, Zone.Cache Purge" permissions. Limit this to one specific zone if possible.
  3. Define environment variables in .env:

You can explicitly define the CLOUDFLARE_ZONE_ID variable if your API key does not allow you to read Zone information. When setting CLOUDFLARE_SERVER_NAME, you are telling the module to only issue purge commands for this specific hostname. This must match any caching or rewrite rules defined in your zone. For example, if your production domain name is "www.example.org", set "www.example.org" not "example.org".

Cache Rules

It is recommended that you add the below to your Cloudflare Cache Rules as no-cache

Rule Comments
example.org/*stage=Stage* It is outside the scope of this module to handle cache purging for drafts. Drafts should never need to be cached as they're not usable on the front end
example.org/Security/* Prevents caching of the login page etc
example.org/admin/* Prevents caching of the Administrator Panel
example.org/dev/* Prevents caching of the development tools

Bypass Cache Example

Troubleshooting and FAQ

Q. The SS Cloudflare administrator section is blank! A. If the Cloudflare administration panel isn't loading correctly, a quick ?flush=1 will resolve this issue.

Q. The SS Cloudflare footer always says "Zone ID: UNABLE TO DETECT". A. This module dynamically retrieves your Zone ID by using the domain you have accessed the website with, unless you have configured it to bypass this. Ensure this domain is correctly registered under your Cloudflare account. If the issue persists, please open a ticket in our issue tracker and provide as much information you can.

Contributing, Bugs & Issues

If you feel you can improve this module in any way, shape or form please do not hesitate to submit an issue, or a PR for review. To report a bug or an issue please use our issue tracker.

License

This module is distributed under the BSD-3 Clause license.


All versions of silverstripe-cloudflare with dependencies

PHP Build Version
Package Version
Requires php Version ^8
ext-json Version *
ext-curl Version *
psr/cache Version *
silverstripe/cms Version ^5
symbiote/silverstripe-queuedjobs Version ^5
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 catalyst.net.nz/silverstripe-cloudflare contains the following files

Loading the files please wait ...