staabm/http-cache-control
Composer 安装命令:
composer require staabm/http-cache-control
包简介
A tiny lib which provides documented constants and example use-cases for the HTTP Cache-Control header.
README 文档
README
A tiny lib which provides documented constants and example use-cases for the HTTP Cache-Control header, based on the official cloudflare documentation.
Sending proper Cache-Control headers is essential to each web-application, but the required keywords are sometimes misleading and ambiguous. This library aims to provide a more reliable and consistent way to set the Cache-Control header.
Example
use staabm\HttpCacheControl\Constants; use staabm\HttpCacheControl\UseCase; class MyController { public function sendPdf(string $pdfFile) { header(Constants::CACHE_CONTROL .':'. UseCase::cacheOnBrowserAndProxyRequireProxyRevalidation()); readfile($pdfFile); } public function sendGdpr(string $pdfFile) { header(Constants::CACHE_CONTROL_CLOUDFLARE .':'. UseCase::cacheOnBrowserAndProxyForDifferentTime(300, 3600)); readfile($pdfFile); } }
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-11