yate-wireless/api 问题修复 & 功能扩展

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

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

yate-wireless/api

最新稳定版本:0.1.0

Composer 安装命令:

composer require yate-wireless/api

包简介

Yate core products API wrapper for PHP

关键字:

README 文档

README

Purpose

This package intended to simplify communication to Yate core products API. Build for composer with PSR-4 autoload, only depends from PSR standard implementations and a good to integrate with DI containers.

It is decoupled from most of depenencies, requiring standart PSR interfaces instead of exact implementations. It uses:

  • PSR-7 standard interfaces used for Request, Response and Stream
  • PSR-17 standard interfaces used for RequestFactory and StreamFactory to create PSR-7 objects
  • PSR-18 standard interface for HTTP clients used

Usage

Start with simple usage example, check ApiGen docs. This lib may make communications to the core components much simpler, but you still need deep knowledge of architecture, entities and logics. Use Yate API docs.

Mostly, you only need to:

  • Create Config object, which carry Yate core product location and credentials
  • Configure Api class instance with Config and other dependencies (manually, autowire, container, whatever)
  • Use call() method to send api requests to proper nodes and got ApiResponse object
  • Access response fields as associated array or properties

More complex scenario: instead of use call() you may use prepareRequest() method to convert you functional request to API to PSR-7 standard request object, send it, got PSR-7 Response object and thet process it with static Api::parseResult() to ApiResponse object. This could be useful for async and bulk operations which are not supported by PSR-18 client interface.

For example, you need to complete 1000 independent calls as soon as possible, so you use above methods combined with Guzzle concurrent requests feature, so Guzzle do it's job for concurent call while this lib provides API request to PSR-7 request and PSR-7 response to functional result.

Also, prepareRequest() and Api::parseResult() should work fine in Async calls/promises and may be used in extra promise layer to implement async call to Yate API.

Installation

In the Composer storage. Just add proper require section:

    "require": {
        "yate-wireless/api": "^0.1"
    }

Please, review the changelog before to change used version.

Dependencies

Composer dependencies:

  • php: ^7.4|^8.0|^8.1|^8.2|^8.3
  • psr/http-message-implementation: ^1.0
  • psr/http-factory-implementation: ^1.0
  • psr/http-client-implementation: ^1.0

Testing

Tested with PHPUnit 9.6 on php 7.4 to 8.3, 100% coverage, which does not mean everything will work as intended. Guzzle PSR-7 used for unit tests.

Current testing and compatibility status check on Github flows

To test, install in dev mode and use:

  • composer test command from library root for run all modular tests

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-27