PHP code example of nassau / kunstmaan-static-site-bundle

1. Go to this page and download the library: Download nassau/kunstmaan-static-site-bundle 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/ */

    

nassau / kunstmaan-static-site-bundle example snippets


class DiskPreservingFileSystemStorage implements Storage {
    public function storeStaticSite($location, StaticSiteDumper $dumper) {
        foreach ($dumper->getStaticSite() as $path => $response) {
            if (rand(1,10) > 5) {
                // we’re running out of disk space, let’s skip some files!
                continue;
            }
            
            // do stuff!
        }
    }
}

class FormatsGenerator extends RouteParametersGenerator
{
    /**
     * @return array[]
     */
    public function getItems() {
        return [
            ['_format' => 'html'],
            ['_format' => 'json'],
            ['_format' => 'xml'],
        ];
    }
}