emanueleminotto / guzzle-cache-subscriber
Server side caching for Guzzle 4/5
Installs: 1 452
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- doctrine/cache: ~1.4
- guzzlehttp/cache-subscriber: 0.1.*
- guzzlehttp/guzzle: ~5.2
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is auto-updated.
Last update: 2024-10-28 07:05:43 UTC
README
Server side caching (based on doctrine/cache) for Guzzle 4/5.
Server side caching helps to improve performances intercepting cached requests before these are sent to the URL (save network usage), and caching (when possible and permitted) responses.
API: emanueleminotto.github.io/guzzle-cache-subscriber
Install
Install the CacheSubscriber adding emanueleminotto/guzzle-cache-subscriber
to your composer.json or from CLI:
$ composer require emanueleminotto/guzzle-cache-subscriber
Usage
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');