定制 doppiogancio/guzzle-bundle-base-path-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

doppiogancio/guzzle-bundle-base-path-plugin

最新稳定版本:v1.0.0

Composer 安装命令:

composer require doppiogancio/guzzle-bundle-base-path-plugin

包简介

A Plugin for Guzzle Bundle, that will help you setting a base path to each request of your client.

README 文档

README

A Plugin for Guzzle Bundle, that will help you to set a base path to each request of your client.

Prerequisites

  • PHP 7.1 or above

Installation

To install this bundle, run the command below on the command line and you will get the latest stable version from [Packagist][4].

composer require doppiogancio/guzzle-bundle-base-path

Usage

Enable bundle

Find next lines in src/Kernel.php:

foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        yield new $class();
    }
}

and replace them by:

foreach ($contents as $class => $envs) {
    if (isset($envs['all']) || isset($envs[$this->environment])) {
        if ($class === \EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class) {
            yield new $class([
                new Doppiogancio\Bundle\GuzzleBundleBasePathPlugin\GuzzleBundleBasePathPlugin(),
            ]);
        } else {
            yield new $class();
        }
    }
}

Basic configuration

# app/config/config.yml

eight_points_guzzle:
    clients:
        api_payment:
            base_url: "http://api.domain.tld"
            
            options:
                auth: oauth2

            # plugin settings
            plugin:
                base_path:
                    base_path:       "/api/v3"

Options

Key Description Required Example
base_path base path to add to every request path yes /api/v3

License

This middleware is licensed under the MIT License - see the LICENSE file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-01