eightpoints/guzzle-wsse-middleware

为 Guzzle 提供的 WSSE 中间件,Guzzle 是一个 PHP HTTP 客户端库和框架,用于构建 RESTful 服务的客户端

v4.3.0 2019-08-09 06:54 UTC

This package is auto-updated.

Last update: 2024-09-13 21:05:25 UTC


README

此中间件将 WSSE 功能集成到 Guzzle 中,Guzzle 是一个用于构建 RESTful 服务的客户端的 PHP 框架。

要求

安装

使用 composer

{
    "require": {
        "eightpoints/guzzle-wsse-middleware": "^4.1.1"
    }
}

使用方法

<?php 

$wsse = new \EightPoints\Guzzle\WsseAuthMiddleware($username, $password);

# Optional: Set createdAt by a expression (if not, current time will be used automatically)
# https://php.ac.cn/manual/en/datetime.formats.relative.php
# Useful if there is a small difference of time between client and server
# DateTime object will be regenerated for every request
$wsse->setCreatedAtTimeExpression('-10 seconds');

$stack = \GuzzleHttp\HandlerStack::create();

// Add the wsse middleware to the handler stack.
$stack->push($wsse->attach());

$client   = new \GuzzleHttp\Client(['handler' => $stack]);
$response = $client->get('http://www.8points.de');

作者

还可以查看参与此项目的 贡献者列表

许可协议

此中间件根据 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件