CloudFlare API Integration

Save resource and clear MODX cache now clear CloudFlare cache.

Creator: Dash Media (dashmedia)

2.1.1-pl (34 KB) Other Versions


About CloudFlare API Integration

Go to System Settings and update the following:

cloudflare.api_key = your CloudFlare api key, this is visible on the Account tab of CloudFlare

cloudflare.email_address = The email address associated with the account (the one you use to log in to CloudFlare)

Optional context/system settings

cloudflare.skip = 1; ignore this context when clearing global cache

cloudflare.use_dev = 1; enable CloudFlare Development mode when clearing the global cache

Please note that PurgeCloudFlare relies on your http_host setting to tell CloudFlare which domain/account to clear files from, if you're using multiple contexts they will each need this setting.

Ignoring a context: if you do not wish PurgeCloudFlare to attempt to clear the CloudFlare cache for a specific context, add a context setting named 'cloudflare.skip' and set its value to 1

Once you have done this, MODX will clear your CloudFlare Cache every time the system-wide cache is cleared, and will clear individual pages when they are saved from the MODX manager

Saving a page will also clear the parents of the saved page (not doing this was confusing many of our clients, so I'd assume you were having similar issues with your own)

Installation Instructions

Install via Package Manager, or grab the static files from our GitHub Repo feel free to report bugs


January 11, 2017
Supported Versions
2.2 – Current
Supported Database

New in CloudFlare API Integration 2.1.1


- Fix for php 5.3.x (Thanks to @getandyjones)


- Upgrade to CloudFlare API V4 (Thanks to @friimaind)


- Fix for clearing single files clearing when domain starts with 'www'


- Fix for domains starting with 'www'

- Allow usedev to be set in system settings or context settings


- enable dev mode now defaults to 0, set context or system setting to 1 to enable


- WARNING: Updated system and context setting names

- Migrate to repoman for package creation


- Fix error caused by browser plugin which changed the urls being referenced for the api


- Fix the enable dev mode flag


- All parents of saved document also purged from cloudflare cache on save


- Clearing site cache will now activate development mode for the domain

- Add cfuse_dev context option


- Removed system settings from namespace as ThemePackagerComponent doesn't seem to fully-support them yet, this was preventing people from saving the system settings until they were moved into another namespace


- PugeSingeFile added, PurgeCloudFlare will now clear individual pages from the CloudFlare cache when they are saved from the manager (Yep, how cool is that)

- Added support for multiple contexts


- Inital Commit


Current Releases

January 11, 2017
2.2 – Current
View Deprecated Releases

More from Dash Media



Output modifier turns an address into a Google Maps static map.



Snippet returns the value of a TV, recursively returning values from…



Creates @1x and @2x images using srcset html attribute.



Snippet returns a list of resource ids. A fork of GetIds.