承接 complex-media/guzzle-hawk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

complex-media/guzzle-hawk

最新稳定版本:v0.1.0

Composer 安装命令:

composer require complex-media/guzzle-hawk

包简介

A GuzzlePHP plugin for Hawk authentication

README 文档

README

Originally developed by jeskew, this extremely simple Plugin provides middleware you can place on your Guzzle client to automagically sign your requests.

Usage

First, install with Composer:

composer require complex-media/guzzle-hawk

Then, use it in code.

use ComplexMedia\Guzzle\Plugin\Hawk;
use GuzzleHttp\Client as Guzzle;

$client = new Guzzle();
$signer = new Hawk($key, $secret, $algorithm, $offset);

$client->getEmitter()->attach($signer);
$response = $client->get($URL);

$algorithm will default to 'sha256', but you can set it to whatever your system supports. $offset adds a clock skew to synchronize with your server, and defaults to 0. If you get a 401 from your server, you can adjust several properties on the signer and try again immediately:

$signer->key = $new_key
$signer->secret = $new_secret
$signer->algorithm = $new_algorithm
$signer->offset = $new_offset

$response = $client->get($URL);

Contributing

Yes

License

MIT License applies.

统计信息

  • 总下载量: 171
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-14