PHP code example of emanueleminotto / guzzle-cache-subscriber
1. Go to this page and download the library: Download emanueleminotto/guzzle-cache-subscriber 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/ */
emanueleminotto / guzzle-cache-subscriber example snippets
use GuzzleHttp\Client;
use EmanueleMinotto\Guzzle\CacheSubscriber;
$client = new Client();
$subscriber = new CacheSubscriber(/* Doctrine cache instance, optional */);
// there are the getCache and setCache methods to
// change the storage system
$client->getEmitter()->attach($subscriber);
// request sent
$client->get('http://httpbin.org');
// request intercepted
$client->get('http://httpbin.org');