Update README with better usage example
This commit is contained in:
parent
e6028d6379
commit
760d0a7686
|
@ -1,6 +1,8 @@
|
||||||
HTTP Signatures Guzzle 3
|
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]
|
Adds Guzzle 3 support to [99designs/http-signatures][99signatures]
|
||||||
|
|
||||||
Signing with Guzzle 3
|
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.
|
This library includes support for automatically signing Guzzle requests using an event subscriber.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
use HttpSignatures\Context;
|
||||||
use HttpSignatures\Guzzle\CreateRequestSubscriber;
|
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 = new \Guzzle\Http\Client('http://example.org');
|
||||||
$client->addSubscriber(new CreateRequestSubscriber($context));
|
$client->addSubscriber(new CreateRequestSubscriber($context));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue