PHPackages                             phattarachai/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. [Caching](/categories/caching)
4. /
5. phattarachai/laravel-cloudflare

ActiveLibrary[Caching](/categories/caching)

phattarachai/laravel-cloudflare
===============================

Purge the Cloudflare edge cache, toggle development mode, and register tunnel DNS records from artisan — built for apps behind a shared Cloudflare zone.

v1.0.0(today)010↑2600%MITPHPPHP ^8.2CI passing

Since Aug 8Pushed todayCompare

[ Source](https://github.com/phattarachai/laravel-cloudflare)[ Packagist](https://packagist.org/packages/phattarachai/laravel-cloudflare)[ RSS](/packages/phattarachai-laravel-cloudflare/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Laravel Cloudflare
==================

[](#laravel-cloudflare)

[![Latest Version on Packagist](https://camo.githubusercontent.com/86f7630dcd44675502c83cd697e884a17af2bd694a52c54c76d272964ce6ffde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068617474617261636861692f6c61726176656c2d636c6f7564666c6172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phattarachai/laravel-cloudflare)[![Tests](https://camo.githubusercontent.com/edd4e71757870da23373f0e43fbec24c6a89dd493526db04ad3140bc90d68ae6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068617474617261636861692f6c61726176656c2d636c6f7564666c6172652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/phattarachai/laravel-cloudflare/actions/workflows/run-tests.yml?query=branch%3Amain)[![Code Style](https://camo.githubusercontent.com/9326b44284ee02a36ca745d4f71b2d083bd389c7418f36dd4cf04f9c83dcf164/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068617474617261636861692f6c61726176656c2d636c6f7564666c6172652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/phattarachai/laravel-cloudflare/actions/workflows/fix-php-code-style-issues.yml?query=branch%3Amain)[![PHP Version](https://camo.githubusercontent.com/b8a152aeaec0c190029e2e7c168bb017973af7a22a42bde22c940e267eaf0c80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7068617474617261636861692f6c61726176656c2d636c6f7564666c6172652f7068703f7374796c653d666c61742d737175617265266c6162656c3d706870266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/phattarachai/laravel-cloudflare)[![Laravel Version](https://camo.githubusercontent.com/40b206cc348cdb6d50101f3474a9b9f26e1b52ff21226dce2cb91104ec09ab7e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d3131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/40b206cc348cdb6d50101f3474a9b9f26e1b52ff21226dce2cb91104ec09ab7e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d3131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)[![Total Downloads](https://camo.githubusercontent.com/54d65cfd6e20a8d696e72ff84b8f16c9376c0f9906d1e35a1efd6872126bdcae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068617474617261636861692f6c61726176656c2d636c6f7564666c6172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phattarachai/laravel-cloudflare)

Purge the Cloudflare edge cache, toggle Development Mode, and register tunnel DNS records from artisan. Built for a fleet of apps sharing one Cloudflare zone behind a cloudflared tunnel, where `purge_everything` and Enterprise-only `hosts`/`prefixes` purges are both wrong.

Install
-------

[](#install)

```
composer require phattarachai/laravel-cloudflare
php artisan vendor:publish --tag=cloudflare-config
```

Set the zone id (a public identifier, safe to commit) and, if you register DNS, the tunnel id:

```
CLOUDFLARE_ZONE_ID=...
CLOUDFLARE_TUNNEL_ID=...
```

The API token is resolved at runtime and falls back to the process env, so on a self-hosted runner you inject `CLOUDFLARE_API_TOKEN` once (in the runner's `.env`) and no repo needs a secret. A Zone → Cache Purge scope covers purge and dev-mode; add Zone → DNS Edit to use `cloudflare:dns`.

Purge
-----

[](#purge)

```
php artisan cloudflare:purge                 # document root + every built asset from the Vite manifest
php artisan cloudflare:purge --url=https://…/sitemap.xml   # plus explicit URLs (repeatable)
php artisan cloudflare:purge --everything --force          # whole zone — nukes every app on a shared zone
```

Purges by exact `files` derived from `public/build/manifest.json`. Make it the last deploy step:

```
- run: php artisan cloudflare:purge || true
```

When there is no token or no manifest it exits 0 without calling the API, so dev, tests, and a not-yet-configured repo keep CI green.

Development Mode
----------------

[](#development-mode)

```
php artisan cloudflare:dev-mode          # show current state
php artisan cloudflare:dev-mode on       # bypass the edge cache for ~3 hours
php artisan cloudflare:dev-mode off
```

DNS
---

[](#dns)

Upsert-only — it never deletes a record it did not declare, so it is safe against the shared zone.

```
php artisan cloudflare:dns --name=new-app.phattarachai.app --tunnel   # proxied CNAME → .cfargotunnel.com
php artisan cloudflare:dns --name=txt.example.com --type=TXT --content='v=spf1 -all' --dns-only
php artisan cloudflare:dns --list
php artisan cloudflare:dns --name=old.example.com --delete --force
```

Declare an app's own records in `config/cloudflare.php` and a bare `php artisan cloudflare:dns`upserts them — handy as a one-off when spinning up a new subdomain:

```
'dns' => [
    'records' => [
        ['name' => 'new-app.phattarachai.app', 'tunnel' => true],
    ],
],
```

Testing
-------

[](#testing)

```
composer test
```

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62843288?v=4)[phatchai](/maintainers/phatchai)[@phatchai](https://github.com/phatchai)

---

Top Contributors

[![phattarachai](https://avatars.githubusercontent.com/u/2162876?v=4)](https://github.com/phattarachai "phattarachai (1 commits)")

---

Tags

laravelcachednscloudflarecdnpurgetunnelcloudflared

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.3M73](/packages/spatie-laravel-responsecache)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M206](/packages/laravel-mcp)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k1](/packages/mike-bronner-laravel-model-caching)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M183](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1614.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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