Skip to content

Commit

Permalink
Small readme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Coolsaet committed Nov 1, 2019
1 parent 2485a45 commit 4099b32
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "brightfish/caching-guzzle",
"description": "Caching HTTP responses through Guzzle middleware",
"version": "1.0.4",
"version": "1.0.5",
"type": "library",
"keywords": ["guzzle", "middleware", "cache", "laravel"],
"require": {
Expand Down
27 changes: 13 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ implementing the PSR-16 caching interface.
composer require brightfish/caching-guzzle
```

## Using the middleware (with Laravel)
```
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Brightfish\CachingGuzzle\Middleware;
$store = app('cache')->store('database');
$handler = new CacheMiddleware($store, 3600);
$stack = HandlerStack::create();
$stack->push($handler);
$client = new Client(['handler' => $stack]);
```

## Using the wrapper (with Laravel)
```
use Brightfish\CachingGuzzle\Client;
Expand Down Expand Up @@ -40,19 +53,6 @@ $response_2 = $client->post('/resource/84', [
$cached_response = $store->get('//example.org/api/resource');
```

## Using the middleware (with Laravel)
```
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Brightfish\CachingGuzzle\Middleware;
$store = app('cache')->store('database');
$handler = new CacheMiddleware($store, 3600);
$stack = HandlerStack::create();
$stack->push($handler);
$client = new Client(['handler' => $stack]);
```

## Available options

### Per request:
Expand Down Expand Up @@ -93,4 +93,3 @@ $handler = new CacheMiddleware($cache, $ttl, $log);

## License
GNU General Public License (GPL). Please see License File for more information.

0 comments on commit 4099b32

Please sign in to comment.