PHP code example of f_roepstorf / static-cache-buster

1. Go to this page and download the library: Download f_roepstorf/static-cache-buster 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/ */

    

f_roepstorf / static-cache-buster example snippets

bash
php artisan cache-buster:warm
nginx
set $try_location @static;

if ($request_method != GET) {
    set $try_location @not_static;
}

if ($args ~* "live-preview=(.*)") {
    set $try_location @not_static;
}

# Skip static cache when cache buster header is present
if ($http_x_statamic_cache_buster = "true") {
    set $try_location @not_static;
}

location / {
    try_files $uri $try_location;
}

location @static {
    try_files /static/${host}${uri}_$args.html $uri $uri/ /index.php?$args;
}

location @not_static {
    try_files $uri /index.php?$args;
}