Update package to support Guzzle 6 and stop supporting old versions.

This commit is contained in:
Ruben de Vries
2015-11-09 18:11:11 +01:00
parent 2224bdd3c3
commit 84239d4762
10 changed files with 229 additions and 207 deletions

View File

@@ -0,0 +1,19 @@
<?php
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']]);