This Guzzle Bundle plugin integrates ion-bazan/aliyun-http-signer with Symfony.
- PHP 7.2 or above
- Guzzle Bundle
Use Composer to install the plugin using:
composer require ion-bazan/guzzle-bundle-aliyun-signer-plugin
Register the bundle in app/AppKernel.php
file:
new EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle([
new IonBazan\Bundle\GuzzleBundleAliyunSignerPlugin\AliyunRequestSignerPlugin(),
]);
To register the plugin in Symfony 4 and newer, replace registerBundles()
method in src/Kernel.php
:
public function registerBundles(): iterable
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
if ($class === \EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class) {
yield new $class([
new \IonBazan\Bundle\GuzzleBundleAliyunSignerPlugin\AliyunRequestSignerPlugin(),
]);
} else {
yield new $class();
}
}
}
}
# config/packages/eight_points_guzzle.yaml
eight_points_guzzle:
clients:
my_client:
base_url: "http://target.url"
plugin:
aliyun_signer:
app_id: 'Your AppID'
secret: 'Your Secret'
If you found a bug or security vulnerability, please open an issue
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.