https://github.com/ionbazan/aliyun-http-signer
PSR-7-compatible Alibaba Cloud API Gateway request signing implementation. Integrates with Guzzle ⛽️ and HttPlug 🐘.
https://github.com/ionbazan/aliyun-http-signer
alibaba-cloud alibabacloud aliyun api-gateway guzzle hmac httplug php psr-7 sign signature
Last synced: about 1 month ago
JSON representation
PSR-7-compatible Alibaba Cloud API Gateway request signing implementation. Integrates with Guzzle ⛽️ and HttPlug 🐘.
- Host: GitHub
- URL: https://github.com/ionbazan/aliyun-http-signer
- Owner: IonBazan
- License: mit
- Created: 2020-04-28T08:55:05.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-05T15:44:52.000Z (about 2 years ago)
- Last Synced: 2024-10-14T06:26:37.995Z (7 months ago)
- Topics: alibaba-cloud, alibabacloud, aliyun, api-gateway, guzzle, hmac, httplug, php, psr-7, sign, signature
- Language: PHP
- Homepage: https://packagist.org/packages/ion-bazan/aliyun-http-signer
- Size: 25.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Alibaba Cloud API Gateway HTTP Request Signer for PHP
[](https://packagist.org/packages/ion-bazan/aliyun-http-signer)
[](https://github.com/IonBazan/aliyun-http-signer/actions)
[](https://packagist.org/packages/ion-bazan/aliyun-http-signer)
[](https://codecov.io/gh/IonBazan/aliyun-http-signer)
[](https://dashboard.stryker-mutator.io/reports/github.com/IonBazan/aliyun-http-signer/master)
[](https://scrutinizer-ci.com/g/IonBazan/aliyun-http-signer/?branch=master)
[](https://packagist.org/packages/ion-bazan/aliyun-http-signer)
[](https://packagist.org/packages/ion-bazan/aliyun-http-signer)This library implements [Alibaba Cloud API Gateway request signature](https://www.alibabacloud.com/help/doc-detail/29475.htm) calculation for [PSR-7](https://www.php-fig.org/psr/psr-7/) compatible requests.
It integrates with [Guzzle](https://github.com/guzzle/guzzle) and [HttPlug](https://github.com/php-http/httplug) but can be used with any PSR-7-compatible client.# Installation
Use [Composer](https://getcomposer.org/) to install the package using:```bash
composer require ion-bazan/aliyun-http-signer
```# Usage
## Symfony integration
The easiest way to integrate the package with Symfony is using [GuzzleBundleAliyunSignerPlugin](https://github.com/IonBazan/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
signRequest($request);
}
```## Sign an API request using Guzzle middleware
```php
push($middleware);$client = new Client(['handler' => $stack]);
$response = $client->get('https://example.com/api/v1/test');
```## Sign an API request using HttPlug plugin
```php
sendRequest($request);
```# Bugs & issues
If you found a bug or security vulnerability, please [open an issue](https://github.com/IonBazan/aliyun-http-signer/issues/new)
# 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.