auto1-oss/service-api-client-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

auto1-oss/service-api-client-bundle

最新稳定版本:v2.8.2

Composer 安装命令:

composer require auto1-oss/service-api-client-bundle

包简介

Auto1 Service API Client for PHP projects

README 文档

README

Bundle uses php-http/httplug client abstraction. So you'll need to install some psr7-compatible client into your project to be used by this bundle. For more details: php-http/httplug clients and adapters.

config.yml

auto1_service_api_client: request_visitors: - '@visitor1' - '@visitor2' strict_mode: false
  • request_visitors - Request visitors (RequestVisitorInterface) are aimed to modify your Request - like adding custom headers. You can also TAG services with 'auto1.api.request_visitor' to make them visitors. Warning! By setting this configuration you will override default values!
  • strict_mode - boolean, false by default. If it is true the request factory ignores any request body for GET, HEAD, OPTIONS and TRACE HTTP methods. In other words, client will always send such requests without body.

Example of EP definition (yaml):

postUnicorn: method: 'POST' baseUrl: 'http://google.com' path: '/v1/unicorn' requestFormat: 'url' requestClass: 'Auto1\ServiceDTOCollection\Unicorns\Request\PostUnicorn' responseClass: 'Auto1\ServiceDTOCollection\Unicorns\Response\Unicorn' listUnicorns: method: 'GET' baseUrl: 'http://google.com' path: '/v1/unicorns' requestFormat: 'json' requestClass: 'Auto1\ServiceDTOCollection\Unicorns\Request\SearchUnicorns' responseClass: 'Auto1\ServiceDTOCollection\Unicorns\Response\Unicorn[]'

Example of ServiceRequest implementation:

class PostUnicorn implements ServiceRequestInterface { private $horn; public function setHorn(string $horn): self { $this->horn = $horn; return $this; } public function getHorn() { return $this->horn; } }

Example of Repository implementation:

class UnicornRepository { public function __construct(APIClientInterface $apiClient,) { $this->apiClient = $apiClient; } /**  * @param string $horn  *  * @return Unicorn[]  */ public function getListByHorn(string $horn): array { $serviceRequest = (new GetUnicornsByHornRequest())->setHorn($horn); return $this->apiClient->send($serviceRequest); } }

For more info - have a look at service-api-components-bundle usage:

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 4
  • Forks: 22
  • 开发语言: PHP

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固