paqtcom/external-api-call-client 问题修复 & 功能扩展

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

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

paqtcom/external-api-call-client

Composer 安装命令:

composer require paqtcom/external-api-call-client

包简介

Setup code for making a client to an external API client

README 文档

README

Setup code for making a client to an external API.

Some very low-level classes used to structure calls to external API's. Internally this works like a state machine for API calls. And in every step the API call can fail.

State machine

Code usage:

Basically you use ExternalClient as base class and extend it and add functionality like this:

<?php
use GuzzleHttp\Client;
use PaqtCom\ExternalApiCallClient\Services\ExternalClient;
use PaqtCom\ExternalApiCallClient\ErrorHandlers\ThrowExceptionOnError;

class ExampleClient extends ExternalClient
{
  public function __construct(Client $client)
  {
      parent::__construct(new JsonRequestFactory(), $client, new JsonResponseHandler(), new ThrowExceptionOnError(), new LogToDatabase());
  }
  
  public function createOrder(OrderDto $order): OrderPlacedDto
  {
      return $this->post(new ExternalClientCall('Place order ' . $order->id, '/api/Order/' . $order->id , OrderPlacedDto::class), $order);
  }
}

The ExternalClient makes the actual call and uses the ExternalClientCall to remember the current state of an API call.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-08-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固