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

ActiveLibrary[Caching](/categories/caching)

fuelviews/laravel-cloudflare-cache
==================================

Laravel cloudflare cache package

v1.0.2(8mo ago)12.8k↑133.3%[2 PRs](https://github.com/fuelviews/laravel-cloudflare-cache/pulls)MITPHPPHP ^8.3CI passing

Since Mar 22Pushed 3mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (11)Versions (18)Used By (0)

Laravel Cloudflare Cache
========================

[](#laravel-cloudflare-cache)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a26950aced5ec3008bf703d1f444899275d2b2ed57f9c6383feb66979b9864e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6675656c76696577732f6c61726176656c2d636c6f7564666c6172652d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuelviews/laravel-cloudflare-cache)[![GitHub Tests Action Status](https://camo.githubusercontent.com/7743881447ef9d9497dcd7f9d951440d4a0cc73d59e078d3af7026940e6c8062/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6675656c76696577732f6c61726176656c2d636c6f7564666c6172652d63616368652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/fuelviews/laravel-cloudflare-cache/actions/workflows/run-tests.yml?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/bf3fb8898f90d522c2a92937888ad2064861ea586b4ff2c6eb50cf88a5c32284/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6675656c76696577732f6c61726176656c2d636c6f7564666c6172652d63616368652f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/fuelviews/laravel-cloudflare-cache/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/84fb495446cdb5310a4401a383c806ee4eba1963377b0a53241571173c4b9c1c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6675656c76696577732f6c61726176656c2d636c6f7564666c6172652d63616368652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuelviews/laravel-cloudflare-cache)[![PHP Version](https://camo.githubusercontent.com/33430a1c9affe51d23840404e5b74e01208118f8e2e48b63a9413b89296982c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/9a53bef6bfbb6cb990aa06777c8b0a19b5ef9f43dd3c3747bbe19bc39630167b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d2535453130253743253545313125374325354531322d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)

A powerful and intuitive Laravel package for managing Cloudflare cache purging directly from your Laravel application. Streamline your cache management workflow with comprehensive commands, validation, and seamless integration.

📋 Requirements
--------------

[](#-requirements)

- PHP 8.3+
- Laravel 10.x, 11.x, or 12.x
- Cloudflare account with API access

🚀 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require fuelviews/laravel-cloudflare-cache
```

### Quick Setup

[](#quick-setup)

Run the install command for guided setup:

```
php artisan cloudflare-cache:install
```

This will:

- Publish the configuration file
- Guide you through credential setup
- Validate your configuration
- Provide helpful next steps

### Manual Setup

[](#manual-setup)

Alternatively, you can manually publish the configuration:

```
# Publish configuration
php artisan vendor:publish --tag="cloudflare-cache-config"

# Publish service provider for advanced customization (optional)
php artisan vendor:publish --tag="cloudflare-cache-provider"
```

⚙️ Configuration
----------------

[](#️-configuration)

### Environment Variables

[](#environment-variables)

Add your Cloudflare credentials to your `.env` file:

```
# Required
CLOUDFLARE_CACHE_API_KEY=your_api_key_here
CLOUDFLARE_CACHE_ZONE_ID=your_zone_id_here

# Optional
CLOUDFLARE_CACHE_DEBUG=false
```

### Getting Your Cloudflare Credentials

[](#getting-your-cloudflare-credentials)

1. **API Key**: Create an API token at [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens)

    - Use the "Custom token" option
    - Required permissions: `Zone:Zone:Read`, `Zone:Cache Purge:Edit`
    - Zone Resources: Include specific zones or all zones
2. **Zone ID**: Find your Zone ID in your Cloudflare dashboard

    - Go to your domain overview
    - Find "Zone ID" in the right sidebar
    - It's a 32-character hexadecimal string

### Configuration File

[](#configuration-file)

The published configuration file `config/cloudflare-cache.php`:

```
