Update README with better usage example

This commit is contained in:
Adrian Palmer 2014-08-28 09:59:31 +10:00
parent e6028d6379
commit 760d0a7686
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,8 @@
HTTP Signatures Guzzle 3
===
[![Build Status](https://travis-ci.org/99designs/http-signatures-guzzle.svg)](https://travis-ci.org/99designs/http-signatures-guzzle)
Adds Guzzle 3 support to [99designs/http-signatures][99signatures]
Signing with Guzzle 3
@ -9,8 +11,15 @@ Signing with Guzzle 3
This library includes support for automatically signing Guzzle requests using an event subscriber.
```php
use HttpSignatures\Context;
use HttpSignatures\Guzzle\CreateRequestSubscriber;
$context = new Context(array(
'keys' => array('examplekey' => 'secret-key-here'),
'algorithm' => 'hmac-sha256',
'headers' => array('(request-target)', 'Date', 'Accept'),
));
$client = new \Guzzle\Http\Client('http://example.org');
$client->addSubscriber(new CreateRequestSubscriber($context));