steadlane/silverstripe-cloudflare
Composer 安装命令:
composer require steadlane/silverstripe-cloudflare
包简介
This module aims to relieve the stress of using Cloudflare caching with any SilverStripe project. Adds extension hooks that clears Cloudflare's cache for a specific page when that page is published or unpublished.
README 文档
README
Introduction
The intention of this module is to relieve the double-handling required when updating any of your pages within the CMS of SilverStripe while being behind Cloudflare. When a page is Published or Unpublished a call will be made to the relevant Cloudflare endpoint to clear the cache of the URL/Page you just published/unpublished.
This allows you to see your changes instantly in the preview window without having to worry about logging into the Cloud Flare dashboard to purge the cache yourself.
Cloudflare allows you to have multiple domains registered under a single account. This module is versatile in the sense that it will automatically detect which Zone ID is to be used alongside the domain that this module is installed on. Therefore beyond the two configuration settings required below there is no additional setup required. You can "plug and play" this module in as many locations as you want which means you don't have to worry about tracking down the relevant Zone ID (you can only get it via the API).
Remember: Always keep your API authentication details secure. If you are concerned with your credentials being on someone else's machine; have them set up their own Cloudflare account.
Note: The detected Zone ID will always be shown in the SilverStripe Administration panel whilst viewing the "Cloudflare" menu item
Features
- Dynamic Zone ID Detection
- Intelligent Purging
- If you modify the title or URL of any page: All cache for the zone will be purged.
- If you modify the contents of any page: Only the cache for that page will be purged.
- If you modify any page that has a parent, the page you modified and all of it's parents will be purged too.
- Manual Purging
- The administration area for this module allows you to either purge all css files, all javascript files, all image files or ... everything.
Installation
This module only supports installation via composer:
composer require steadlane/silverstripe-cloudflare
Run /dev/build afterwards and ?flush=1 for good measure for SilverStripe to become aware of this module
Configuration
Configuration for this module is minimal, you need only define two constants in mysite/_config.php
define('CLOUDFLARE_AUTH_EMAIL', 'mycloudflare@example.com.au');
define('CLOUDFLARE_AUTH_KEY', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
Or alternatively, define environment variables in .env
CLOUDFLARE_AUTH_EMAIL="mycloudflare@example.com.au"
CLOUDFLARE_AUTH_KEY="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Cache Rules
It is recommended that you add the below to your Cloudflare Cache Rules as no-cache
| Rule | Comments |
|---|---|
example.com.au/*stage=Stage* |
It is outside the scope of this module to handle cache purging for drafts. Drafts should never need to be cached as they're not usable on the front end |
example.com.au/Security/* |
Prevents caching of the login page etc |
example.com.au/admin/* |
Prevents caching of the Administrator Panel |
example.com.au/dev/* |
Prevents caching of the development tools |
Contributing
If you feel you can improve this module in any way, shape or form please do not hesitate to submit a PR for review.
Troubleshooting and FAQ
Q. The SS Cloudflare administrator section is blank!
A. If the Cloudflare administration panel isn't loading correctly, a quick ?flush=1 will resolve this issue.
Q. The SS Cloudflare footer always says "Zone ID: UNABLE TO DETECT". A. This module dynamically retrieves your Zone ID by using the domain you have accessed the website with. Ensure this domain is correctly registered under your Cloudflare account. If the issue persists, please open a ticket in our issue tracker and provide as much information you can.
Bugs / Issues
To report a bug or an issue please use our issue tracker.
License
This module is distributed under the BSD-3 Clause license.
steadlane/silverstripe-cloudflare 适用场景与选型建议
steadlane/silverstripe-cloudflare 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.73k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2016 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cache」 「silverstripe」 「cloudflare」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 steadlane/silverstripe-cloudflare 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 steadlane/silverstripe-cloudflare 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 steadlane/silverstripe-cloudflare 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Symfony bundle for Cloudflare integration: trusted proxies, real client IP detection, forwarded headers.
Laravel 5 - Repositories to the database layer
Analytics chooser extensions for site settings.
Cloudflare Middleware For Guzzle
统计信息
- 总下载量: 3.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2016-10-17