PHP code example of staabm / http-cache-control
1. Go to this page and download the library: Download staabm/http-cache-control library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
staabm / http-cache-control example snippets
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);
}
}