承接 ion-bazan/aliyun-http-signer 相关项目开发

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

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

ion-bazan/aliyun-http-signer

最新稳定版本:v1.3.0

Composer 安装命令:

composer require ion-bazan/aliyun-http-signer

包简介

PSR-7-compatible Alibaba Cloud API Gateway request signing implementation. Integrates with Guzzle ⛽️ and HttPlug ????.

README 文档

README

Latest version GitHub Workflow Status PHP version Codecov Mutation testing badge Scrutinizer Code Quality Downloads License

This library implements Alibaba Cloud API Gateway request signature calculation for PSR-7 compatible requests. It integrates with Guzzle and HttPlug but can be used with any PSR-7-compatible client.

Installation

Use Composer to install the package using:

composer require ion-bazan/aliyun-http-signer

Usage

Symfony integration

The easiest way to integrate the package with Symfony is using GuzzleBundleAliyunSignerPlugin with Guzzle Bundle.

To use it with HttplugBundle or any other Bundle, simply register RequestSigner, Key and RequestSignerPlugin as services and inject the credentials to the Key service.

Sign a PSR-7-compatible API request

<?php require_once 'vendor/autoload.php'; use IonBazan\AliyunSigner\Key; use IonBazan\AliyunSigner\RequestSigner; use Psr\Http\Message\RequestInterface; function signRequest(RequestInterface $request): RequestInterface { // Provide credentials $appId = '12345678'; $secret = base64_encode('secret'); // Create signer $signer = new RequestSigner(new Key($appId, $secret)); return $signer->signRequest($request); }

Sign an API request using Guzzle middleware

<?php require_once 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\HandlerStack; use IonBazan\AliyunSigner\Key; use IonBazan\AliyunSigner\RequestSigner; use IonBazan\AliyunSigner\Guzzle\RequestSignerMiddleware; // Provide credentials $appId = '12345678'; $secret = base64_encode('secret'); // Create signer and middleware $signer = new RequestSigner(new Key($appId, $secret)); $middleware = new RequestSignerMiddleware($signer); $stack = HandlerStack::create(); $stack->push($middleware); $client = new Client(['handler' => $stack]); $response = $client->get('https://example.com/api/v1/test');

Sign an API request using HttPlug plugin

<?php require_once 'vendor/autoload.php'; use Http\Client\Common\PluginClient; use Http\Discovery\HttpClientDiscovery; use IonBazan\AliyunSigner\Key; use IonBazan\AliyunSigner\RequestSigner; use IonBazan\AliyunSigner\HttPlug\RequestSignerPlugin; // Provide credentials $appId = '12345678'; $secret = base64_encode('secret'); // Create signer and plugin $signer = new RequestSigner(new Key($appId, $secret)); $plugin = new RequestSignerPlugin($signer); $pluginClient = new PluginClient( HttpClientDiscovery::find(), [$plugin] ); $pluginClient->sendRequest($request);

Bugs & issues

If you found a bug or security vulnerability, please open an issue

Contributing

Please feel free to submit Pull Requests adding new features or fixing bugs.

Please note that code must follow PSR-1, PSR-2, PSR-4 and PSR-7.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固