2017 © Pedro Peláez
 

library http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 6

image

99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 6

  • Thursday, May 4, 2017
  • by navitronic
  • Repository
  • 36 Watchers
  • 8 Stars
  • 53,071 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 9 Versions
  • 12 % Grown

The README.md

HTTP Signatures Guzzle 6

Guzzle 6 support for 99designs http-signatures library, (*1)

Build Status, (*2)

Adds 99designs/http-signatures support to Guzzle 6., (*3)

Older Guzzle Versions

For Guzzle 4 & 5 use the v1.x release of this repo. For Guzzle 3 see the 99designs/http-signatures-guzzle repo., (*4)

Signing with Guzzle 6

This library includes support for automatically signing Guzzle requests using Middleware., (*5)

You can use GuzzleHttpSignatures::defaultHandlerFromContext to easily create the default Guzzle handler with the middleware added to sign every request., (*6)

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:, (*7)

<?php

use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
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 = new HandlerStack();
$stack->setHandler(new CurlHandler());
$stack->push(GuzzleHttpSignatures::middlewareFromContext($this->context));
$stack->push(Middleware::history($this->history));
$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']]);

Contributing

Pull Requests are welcome., (*8)

The Versions

04/05 2017

dev-master

9999999-dev https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 6

04/05 2017

2.0.1

2.0.1.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 6

04/05 2017

dev-allow-http-signatures-v4

dev-allow-http-signatures-v4 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 6

17/10 2016

2.0

2.0.0.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 6

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 6

27/09 2016

1.2.2

1.2.2.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 4

19/10 2015

1.2.1

1.2.1.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 4

20/03 2015

1.2.0

1.2.0.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 4

05/03 2015

1.1.0

1.1.0.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 4

28/10 2014

1.0.0

1.0.0.0 https://github.com/99designs/http-signatures-guzzlehttp

Sign and verify HTTP messages with Guzzle 4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Adrian Palmer

https http signature signing hmac signed guzzle 4