PHP code example of mapsight / pulp-cache

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

    

mapsight / pulp-cache example snippets


use OpenMapsight\Pulp;
use OpenMapsight\PulpCache;

$source = Pulp::start()
    ->pipe(Pulp::srcHttp(
        method: 'GET',
        uri: 'https://example.com/data.zip',
        guzzleOptions: ['timeout' => 120],
        aliasFileName: 'data.zip',
    ));

$files = Pulp::start()
    ->pipe(PulpCache::remember($source, __DIR__ . '/cache', [
        'key' => 'example-data',
        'ttl' => 86400,
        'fallbackToStale' => true,
    ]))
    ->run();

Pulp::start()
    ->pipe(Pulp::src('*.geojson', __DIR__ . '/input'))
    ->pipe(PulpCache::cache(__DIR__ . '/cache', [
        'ttl' => 3600,
    ]))
    ->pipe(Pulp::dest(__DIR__ . '/result'))
    ->run();