Go to file
Adrian Palmer 78cccf1a8f Rename CreateRequestSubscriber to RequestSubscriber 2014-08-28 13:02:37 +10:00
src/HttpSignatures/Guzzle Rename CreateRequestSubscriber to RequestSubscriber 2014-08-28 13:02:37 +10:00
tests Rename CreateRequestSubscriber to RequestSubscriber 2014-08-28 13:02:37 +10:00
.gitignore Initial commit 2014-08-27 17:45:39 +10:00
.travis.yml Initial commit 2014-08-27 17:45:39 +10:00
LICENSE.txt Initial commit 2014-08-27 17:45:39 +10:00
README.md Rename CreateRequestSubscriber to RequestSubscriber 2014-08-28 13:02:37 +10:00
composer.json Update composer with correct details and version pinning 2014-08-27 18:01:07 +10:00
phpunit.xml.dist Add phpunit.xml.dist 2014-08-27 17:47:56 +10:00

README.md

HTTP Signatures Guzzle 3

Build Status

Adds Guzzle 3 support to 99designs/http-signatures

Signing with Guzzle 3

This library includes support for automatically signing Guzzle requests using an event subscriber.

use HttpSignatures\Context;
use HttpSignatures\Guzzle\RequestSubscriber;

$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 RequestSubscriber($context));

// The below will now send a signed request to: http://example.org/path?query=123
$client->get('/path?query=123', array(
  'Date' => 'Wed, 30 Jul 2014 16:40:19 -0700',
  'Accept' => 'llamas',
))->send();

Contributing

Pull Requests are welcome.