PHPackages                             ziffmedia/laravel-cloudflare - 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. ziffmedia/laravel-cloudflare

ActiveLibrary

ziffmedia/laravel-cloudflare
============================

A Laravel Nova tool.

v0.4.0(1y ago)4124.8k↓21.7%[1 issues](https://github.com/ziffmedia/laravel-cloudflare/issues)[22 PRs](https://github.com/ziffmedia/laravel-cloudflare/pulls)MITPHPPHP &gt;=7.1.0

Since Aug 12Pushed 1y ago21 watchersCompare

[ Source](https://github.com/ziffmedia/laravel-cloudflare)[ Packagist](https://packagist.org/packages/ziffmedia/laravel-cloudflare)[ RSS](/packages/ziffmedia-laravel-cloudflare/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (30)Used By (0)

Laravel Nova Cloudflare Tool and Field
======================================

[](#laravel-nova-cloudflare-tool-and-field)

Features
--------

[](#features)

- Laravel Nova Tool for adding a cache purge page to manually purge specific urls in batches
- Laravel Nova Field for cache purging specific urls or Cache Tags for a resource
- Option to include either the Tool, Field, or both in project
- Option to use urls, Cache Tag header, or both for purging Cloudflare cache

##### Nova Tool:

[](#nova-tool)

[![Nova Tool Screenshot](./images/tool-screenshot.png)](./images/tool-screenshot.png)

##### Nova Field:

[](#nova-field)

[![Nova Field Screenshot](./images/field-screenshot.png)](./images/field-screenshot.png)

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

[](#installation)

- Install the package into your Laravel application.

```
composer require ziffmedia/laravel-cloudflare
```

- Publish the config file to your application.

```
   php artisan vendor:publish --provider="ZiffMedia\LaravelCloudflare\CloudflareServiceProvider" --tag="config"
```

- Provide the new config file your Cloudflare Zone and API keys in your .env files.

Nova Tool Integration
---------------------

[](#nova-tool-integration)

To provide the cache purge Tool in your Nova instance, you must register the Tool with your NovaServiceProvider:

```
// app/Providers/NovaServiceProvider.php

use ZiffMedia\LaravelCloudflare\Nova\Tools\LaravelCloudflareTool;

public function tools()
{
    return [
        // ...,
        LaravelCloudflareTool::make()
    ];
}
```

For adding permissions to the Tool, please see the Nova [documentation](https://nova.laravel.com/docs/1.0/customization/tools.html#authorization "Nova Tool Documentation").

Note: The Tool is intended only for urls; setup for Cache Tags is not required if only using the Tool or url purging.

Nova Field Integration
----------------------

[](#nova-field-integration)

To provide the Cache Purge button on any resource, you must reference the Field and make sure that you have setup the appropriate purge method (url or Cache Tag).

```
// app/Nova/

use ZiffMedia\LaravelCloudflare\Nova\Fields\ClearCacheButton;

public function fields(Request $request)
{
    ClearCacheButton::make('Cloudflare Cache')
        ->purgeUrls(
            ['https://www.example.com', 'https://www.example.com/page']
        )
        ->purgeTags(function () {
            return $this->cloudflareTagsToClear(); // In order to use this method, you must setup Cache Tags (see below)
        })
        ->hideWhenCreating()
}
```

Cloudflare Cache-Tag Header Integration
---------------------------------------

[](#cloudflare-cache-tag-header-integration)

Cloudflare has the ability to use a special Cache-Tag header on requests to purge multiple pages instantly. If you intend to only use url purging, you can skip this step. In order to setup the Cache-Tag header, follow the below steps:

- Add the Cloudflare Cache-Tag middleware to automatically add the Cache-Tag header to all requests. Because Cloudflare automatically removes the headers, you can use `debug_cache_tags=1` in the querystring of requests to see the output of the header.

```
// app/Http/Kernel.php

use ZiffMedia\LaravelCloudflare\Middleware\CloudflareTagHeaders;

protected $middlewareGroups = [
    'web' => [
        // ...
        CloudflareTagHeaders::class,
    ]
];
```

- Add the Cloudflare controller concern to tell the page which tags to give the header request. Here is an example implementation for an Article resource:

```
// app/Http/Controllers/ArticleController.php

use ZiffMedia\LaravelCloudflare\Controllers\Concerns\CloudflareTaggable;

class ArticleController extends Controller
{
    use CloudflareTaggable;

    public function index()
    {
        // For a collection of models
        $articles = Article::get();
        $this->addCloudflareTagsFromCollection($articles); // This will add a tag to the page for each model in the collection

        // For a single model
        $article = Article::first();
        $this->addCloudflareTagFromModel($article); // This will add a tag to the page for a single model

        return view(...);
    }
}
```

- Add the Cloudflare model concern to tell the headers which tag to use for a model. Additionally, the `cloudflareTagsToClear` and `cloudflareTag` methods can be overwritten to allow for customization of tags or purging of additional resources. Here is a basic example implementation for an Article model:

```
// app/Models/Article.php

use ZiffMedia\LaravelCloudflare\Models\Concerns\CloudflareTaggable;

class Article extends Model
{
    use CloudflareTaggable;
    // ...
}
```

Config Options
--------------

[](#config-options)

- `purge_enabled`: Allows for purging to be turned on or off
- `email`: Email address used for authenticating with Cloudflare API
- `key`: Key used to authenticate with Cloudflare API
- `zone`: Zone used for Cloudflare API
- `domains`: An array of domains which are allowed to be purged. All url purge requests will be validated against these domains, if any.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.4% 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.

###  Release Activity

Cadence

Every ~300 days

Recently: every ~368 days

Total

6

Last Release

601d ago

Major Versions

v0.3.0 → v1.0.0-beta.12024-06-07

PHP version history (2 changes)v0.1.0PHP &gt;=7.1.0

v1.0.0-beta.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c4a15cb4e97bc39a3aea8304fb04d56c0d753f2a6b79c83db0a894647ba8de7?d=identicon)[ralphschindler](/maintainers/ralphschindler)

![](https://www.gravatar.com/avatar/fff234ab9d8ee835e721f4594a9c6521ec0f244bfbd7e700a0d8902e5f22ed1e?d=identicon)[jimbojsb](/maintainers/jimbojsb)

![](https://www.gravatar.com/avatar/e0e0b5cf9abff2f5cb3143f26bee41dc86c5f49128359adf056ee3f5bab7373d?d=identicon)[jcarouth](/maintainers/jcarouth)

---

Top Contributors

[![denizamadoba](https://avatars.githubusercontent.com/u/29383157?v=4)](https://github.com/denizamadoba "denizamadoba (22 commits)")[![jcarouth](https://avatars.githubusercontent.com/u/34648?v=4)](https://github.com/jcarouth "jcarouth (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![emarshall87](https://avatars.githubusercontent.com/u/3854798?v=4)](https://github.com/emarshall87 "emarshall87 (4 commits)")[![ivanmarchenko83](https://avatars.githubusercontent.com/u/38218499?v=4)](https://github.com/ivanmarchenko83 "ivanmarchenko83 (1 commits)")

---

Tags

laravelcloudflarenova

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/ziffmedia-laravel-cloudflare/health.svg)

```
[![Health](https://phpackages.com/badges/ziffmedia-laravel-cloudflare/health.svg)](https://phpackages.com/packages/ziffmedia-laravel-cloudflare)
```

###  Alternatives

[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

51174.8k1](/packages/inspheric-nova-defaultable)[cybercog/laravel-nova-ban

A Laravel Nova banning functionality for your application.

40199.8k](/packages/cybercog-laravel-nova-ban)[orrison/cumulus

Import DNS records from Laravel Vapor into Cloudflare

3817.1k](/packages/orrison-cumulus)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)[padocia/laravel-nova-pdf

Generate Pdf from nova resources

2326.5k](/packages/padocia-laravel-nova-pdf)[joshuapack/laravel-cloudflare

Use the Cloudflare API for Laravel 10-12 using PHP &gt;= 8.1.

122.0k](/packages/joshuapack-laravel-cloudflare)

PHPackages © 2026

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