Go to file
Adrian Palmer 7873dbfa27 Widen installable versions of 99designs/http-signatures 2015-03-20 10:01:27 +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 pay with travis matrix to run test for various guzzle versions 2015-03-04 16:46:18 +01: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 Fix typo in method name in README.md 2015-02-19 12:14:31 +11:00
composer.json Widen installable versions of 99designs/http-signatures 2015-03-20 10:01:27 +11: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->getEmitter()->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.