Go to file
John Barton 55d7e74e99 Merge pull request #1 from blocktrail/master
Import (Merged) Guzzle4 version of http-signatures from blocktrail:guzzle4
2014-10-07 09:40:43 +11:00
src/HttpSignatures/GuzzleHttp Guzzle4 support 2014-10-06 10:23:18 +02:00
tests Guzzle4 support 2014-10-06 10:23:18 +02:00
.gitignore Initial commit 2014-08-27 17:45:39 +10:00
.travis.yml Guzzle4 support 2014-10-06 10:23:18 +02:00
LICENSE Initial commit 2014-10-06 20:06:36 +11:00
LICENSE.txt Initial commit 2014-08-27 17:45:39 +10:00
README.md Import (Merged) Guzzle4 version of http-signatures from https://github.com/blocktrail/http-signatures-guzzle/tree/guzzle4 2014-10-06 14:38:02 +02:00
composer.json Guzzle4 support 2014-10-06 10:23:18 +02:00
phpunit.xml.dist Add phpunit.xml.dist 2014-08-27 17:47:56 +10:00

README.md

HTTP Signatures Guzzle 4

Guzzle 4 support for 99designs http-signatures library

Build Status

Adds 99designs/http-signatures support to Guzzle 4.
For Guzzle 3 see the 99designs/http-signatures-guzzle repo.

Signing with Guzzle 4

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

use HttpSignatures\Context;
use HttpSignatures\GuzzleHttp\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->getEmiter()->attach(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',
));

Contributing

Pull Requests are welcome.