PHPackages                             aceextension/module-cloudflare-cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. aceextension/module-cloudflare-cache

ActiveMagento2-module[Caching](/categories/caching)

aceextension/module-cloudflare-cache
====================================

Cloudflare cache purge integration for Magento 2

00PHP

Since Mar 19Pushed 1mo agoCompare

[ Source](https://github.com/aceextension/module-cloudflare-cache)[ Packagist](https://packagist.org/packages/aceextension/module-cloudflare-cache)[ RSS](/packages/aceextension-module-cloudflare-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Aceextension\_CloudflareCache
=============================

[](#aceextension_cloudflarecache)

Cloudflare cache purge integration for Magento 2. Automatically triggers a Cloudflare purge when Magento cache is cleaned or flushed (via Admin or CLI).

Features
--------

[](#features)

- Purges Cloudflare cache whenever Magento cache is:
    - Cleaned (cache:clean / Admin “Flush Magento Cache”)
    - Flushed (cache:flush / Admin “Flush Cache Storage”)
- Admin configuration for:
    - Enable/Disable integration
    - Cloudflare Zone ID
    - API Token (stored encrypted)
    - Purge Everything toggle
- Depends on `Aceextension_Core` for shared helpers.

Requirements
------------

[](#requirements)

- Magento 2.4.x
- PHP 8.1 or newer
- A Cloudflare API Token with permission to “Cache Purge” for the target Zone

Installation
------------

[](#installation)

1. Place the module in `app/code/Aceextension/CloudflareCache`.
2. Run the usual setup commands:

    ```
    php bin/magento setup:upgrade
    php bin/magento cache:flush
    ```
3. (Optional) If you use Composer for local modules, ensure autoload is refreshed:

    ```
    composer dump-autoload
    ```

Configuration
-------------

[](#configuration)

- Navigate to: Stores → Configuration → Ace Extensions → Cloudflare Cache
- Settings:
    - Enable Integration: Yes/No
    - Zone ID: Your Cloudflare Zone ID (found in Cloudflare dashboard)
    - API Token: A token with purge permission for the Zone (stored encrypted)
    - Purge Everything: Yes/No

Save configuration and clear Magento cache after changes.

How It Works
------------

[](#how-it-works)

- The module attaches a plugin to Magento’s Cache Manager:
    - `afterClean` and `afterFlush` automatically call the Cloudflare API.
- API endpoint used:
    - `POST https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/purge_cache`
    - Authorization: `Bearer {API_TOKEN}`
- Payload:
    - When “Purge Everything” is enabled, `{"purge_everything": true}` is sent.
    - (Future extension can add URL/Host/Tag-specific payloads.)

Testing
-------

[](#testing)

1. Configure Zone ID and API Token in Admin.
2. Run:

    ```
    php bin/magento cache:clean
    ```
3. Verify in Cloudflare dashboard that a purge occurred, or check Magento logs for entries related to Cloudflare purge status.

Security Notes
--------------

[](#security-notes)

- The API Token is stored using Magento’s encrypted backend model and is never logged.
- If a purge fails, only status/error messages are logged without secrets.
- Use a least-privilege API token scoped to the required Zone and “Cache Purge” permission.

Troubleshooting
---------------

[](#troubleshooting)

- No purge happens:
    - Ensure “Enable Integration” is set to Yes.
    - Verify Zone ID and API Token.
    - Check that cache clean/flush actually runs (Admin or CLI).
- API errors in logs:
    - Confirm the token has the correct permissions and the Zone ID is correct.
    - Check outbound connectivity to `api.cloudflare.com` from your environment.

Extending
---------

[](#extending)

- Purge by URLs/Hosts/Cache-Tags:
    - Add new config fields for modes and a UI for entering URLs/hosts.
    - Update `Model/Client.php` to build appropriate payloads (`files`, `hosts`, or `tags`).
- Selective triggers:
    - Narrow the plugin logic to specific cache types by inspecting `$types` in `afterClean`.
- CLI command:
    - Add a Magento CLI command to manually purge Cloudflare on demand.

Module Structure
----------------

[](#module-structure)

- `etc/module.xml` – module declaration, depends on `Aceextension_Core`
- `etc/adminhtml/system.xml` – Admin configuration fields
- `etc/acl.xml` – Admin ACL for configuration
- `etc/di.xml` – Plugin registration for Cache Manager
- `Helper/Data.php` – Configuration access (extends Core helper)
- `Model/Client.php` – Cloudflare API client (Curl-based)
- `Plugin/CacheManagerPlugin.php` – Hooks into cache clean/flush

Uninstall
---------

[](#uninstall)

1. Disable the module and remove its directory:

    ```
    php bin/magento module:disable Aceextension_CloudflareCache
    rm -rf app/code/Aceextension/CloudflareCache
    php bin/magento setup:upgrade
    php bin/magento cache:flush
    ```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance59

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7df3ae913071815d642a0f9f3ba98e324eadfddefa0acc7cdfe567638f269def?d=identicon)[dsguptas](/maintainers/dsguptas)

---

Top Contributors

[![durgagupta](https://avatars.githubusercontent.com/u/2483758?v=4)](https://github.com/durgagupta "durgagupta (2 commits)")

### Embed Badge

![Health badge](/badges/aceextension-module-cloudflare-cache/health.svg)

```
[![Health](https://phpackages.com/badges/aceextension-module-cloudflare-cache/health.svg)](https://phpackages.com/packages/aceextension-module-cloudflare-cache)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
