Download the PHP package yediyuz/laravel-cloudflare-cache without Composer
On this page you can find all versions of the php package yediyuz/laravel-cloudflare-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yediyuz/laravel-cloudflare-cache
More information about yediyuz/laravel-cloudflare-cache
Files in yediyuz/laravel-cloudflare-cache
Package laravel-cloudflare-cache
Short Description laravel-cloudflare-cache
License MIT
Homepage https://github.com/yediyuz/laravel-cloudflare-cache
Informations about the package laravel-cloudflare-cache
Laravel Cloudflare Cache
You can serve millions of requests with this package. This package provides cacheable routes for Cloudflare. Thanks to Cloudflare, your static pages are served efficiently, reducing the load on your servers if they are cached for the TTL (Time to Live) duration. You can purge the cache whenever you need with this package.
Installation
You can install the package via composer:
You can publish the config file with:
Add environment variables to .env file
Add Rule
on Cloudflare
To active caching on static pages, you need to add page rule
OR cache rule
on Cloudflare.
For page rule:
- If the URL matches:
www.example.com/*
- Setting: Cache Level
- Value: Cache Everything
For the cache rule:
- Field: hostname
- Operator: equals
- Value:
example.com
- Then: Eligible for cache
https://developers.cloudflare.com/cache/how-to/cache-rules/create-dashboard/
Usage
Define routes to cache
You can use cache groups for your static contents.
You can use cache tags, so you can clear your caches easily. Specify custom ttl for expire time in seconds. When you do not pass ttl, it will use default ttl given in the config.
[!WARNING]
Be careful caching your routes! Do not cache your dynamic pages such as admin panel or form based pages!
Clear Cache
Purges everything
https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/
Purges by urls
https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/
Purges by prefixes (Enterprise only)
https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/
Purges by tags (Enterprise only)
https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/
Purges by hostname (Enterprise only)
https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/
Post update example to clear cache
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-cloudflare-cache with dependencies
guzzlehttp/guzzle Version ^7.8
illuminate/contracts Version ^10.10|^11.0
illuminate/routing Version ^10.10|^11.0
spatie/laravel-package-tools Version ^1.16