PHP code example of mon-suivi-logement / sellsy-api-v1-cache-strategy
1. Go to this page and download the library: Download mon-suivi-logement/sellsy-api-v1-cache-strategy 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/ */
mon-suivi-logement / sellsy-api-v1-cache-strategy example snippets
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Kevinrob\GuzzleCache\CacheMiddleware;
use Kevinrob\GuzzleCache\Storage\FlysystemStorage;
use Kevinrob\GuzzleCache\Storage\LaravelCacheStorage;
use MonSuiviLogement\GuzzleCache\Strategy\SellsyApiV1Strategy;
$stack = HandlerStack::create();
$cache_middleware = new CacheMiddleware(
new SellsyApiV1Strategy(
new LaravelCacheStorage(
Cache::store('file')
),
1800, // the TTL in seconds
),
);
//Allow POST methods on middleware
$cache_middleware->setHttpMethods(['GET' => true, 'POST' => true]);
$stack->push($cache_middleware,'sellsy-cache');
$guzzle_client = new Client(["handler" => $stack]);
$transport_bridge = new Guzzle6($guzzle_client);