99designs / http-signatures-guzzle
使用 Guzzle 签名和验证 HTTP 消息
v2.0
2016-10-17 04:08 UTC
Requires
- php: >=5.5
- 99designs/http-signatures: ^3.1
- guzzle/guzzle: ~3.9
Requires (Dev)
- phpunit/phpunit: ~4.1
This package is not auto-updated.
Last update: 2024-09-14 16:00:30 UTC
README
为 Guzzle 3 添加 99designs/http-signatures 支持。
关于 Guzzle 4,请参阅 99designs/http-signatures-guzzlehttp 存储库。
使用 Guzzle 3 签名
此库包括使用事件订阅者自动签名 Guzzle 请求的支持。
use HttpSignatures\Context; use HttpSignatures\Guzzle\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->addSubscriber(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', ))->send();
贡献
欢迎提交拉取请求。