ivoba / buzzle
Installs: 28 327
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- doctrine/cache: >=1.3
- kriswallsmith/buzz: >=0.10
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-12-10 22:13:11 UTC
README
Extension for Buzz
It currently extends the Buzz Browser and adds a caching layer with DoctrineCache.
###Installation add ivoba/buzzle to your composer requirements and:
composer update ivoba/buzzle
###Usage If you want to cache your Buzz requests, replace the Buzz/Browser with the Buzzle/Browser.
$browser = new Buzzle/Browser();
$browser->setCacher(new Doctrine/Common/Cache/PhpFileCache($cacheDir), new Buzzle/Validators/CacheValidator());
$browser->call($url, $method, $headers, $content, $cacheLifetime);
###Features
- multiple cache backends like filesystem, redis, memcached etc. thanks to DoctrineCache
- caches only GET or HEAD
- caches only valid HTTP response status code ('200', '203', '204', '205', '300', '301', '410')
- adds a
X-Buzzle-Cache: fresh
header to the response, if from cache - takes care of CacheControl headers
- CacheControl headers can be forced to be ignored:
$Validator->setForceCache(true);
###Todo
- unit tests!
###Disclaimer
- As the name suggests, you might better have a look at guzzle ;) since it has superpower.
- This lib is inspired by: https://github.com/dozoisch/CachedBuzzBundle
###Licence MIT