PHPackages                             99designs/http-signatures-guzzlehttp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. 99designs/http-signatures-guzzlehttp

ActiveLibrary[HTTP &amp; Networking](/categories/http)

99designs/http-signatures-guzzlehttp
====================================

Sign and verify HTTP messages with Guzzle 6

2.0.1(9y ago)13204.5k↓47.1%10[2 PRs](https://github.com/99designs/http-signatures-guzzlehttp/pulls)5MITPHPPHP &gt;=5.5.0CI failing

Since Oct 27Pushed 3y ago63 watchersCompare

[ Source](https://github.com/99designs/http-signatures-guzzlehttp)[ Packagist](https://packagist.org/packages/99designs/http-signatures-guzzlehttp)[ Docs](https://github.com/99designs/http-signatures-guzzlehttp)[ RSS](/packages/99designs-http-signatures-guzzlehttp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (9)Used By (5)

HTTP Signatures Guzzle 6
========================

[](#http-signatures-guzzle-6)

Guzzle 6 support for 99designs http-signatures library

[![Build Status](https://camo.githubusercontent.com/35863d6bc660a876977eac2225259dedab5a79f61a9562f4ebb90ec4acfb19c3/68747470733a2f2f7472617669732d63692e6f72672f393964657369676e732f687474702d7369676e6174757265732d67757a7a6c65687474702e737667)](https://travis-ci.org/99designs/http-signatures-guzzlehttp)

Adds [99designs/http-signatures](https://github.com/99designs/http-signatures-php) support to Guzzle 6.

Older Guzzle Versions
---------------------

[](#older-guzzle-versions)

For Guzzle 4 &amp; 5 use the `v1.x` release of this repo. For Guzzle 3 see the [99designs/http-signatures-guzzle](https://github.com/99designs/http-signatures-guzzle) repo.

Signing with Guzzle 6
---------------------

[](#signing-with-guzzle-6)

This library includes support for automatically signing Guzzle requests using Middleware.

You can use `GuzzleHttpSignatures::defaultHandlerFromContext` to easily create the default Guzzle handler with the middleware added to sign every request.

```
use GuzzleHttp\Client;
use HttpSignatures\Context;
use HttpSignatures\GuzzleHttpSignatures;

require __DIR__ . "/../vendor/autoload.php";

$context = new Context([
    'keys' => ['examplekey' => 'secret-key-here'],
    'algorithm' => 'hmac-sha256',
    'headers' => ['(request-target)', 'date'],
]);

$handlerStack = GuzzleHttpSignatures::defaultHandlerFromContext($context);
$client = new Client(['handler' => $handlerStack]);

// The below will now send a signed request to: http://example.org/path?query=123
$response = $client->get("http://www.example.com/path?query=123", ['headers' => ['date' => 'today']]);
```

Or if you're creating a custom `HandlerStack` you can add the Middleware yourself:

```
