yate-wireless/api
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
Configobject, which carry Yate core product location and credentials - Configure
Apiclass instance with Config and other dependencies (manually, autowire, container, whatever) - Use
call()method to send api requests to proper nodes and gotApiResponseobject - 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 testcommand from library root for run all modular tests
yate-wireless/api 适用场景与选型建议
yate-wireless/api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 12 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「yatebts」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yate-wireless/api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yate-wireless/api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yate-wireless/api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
A lightweight plain-PHP framework for database-backed CRUD APIs.
Modern, strongly-typed, PSR-compliant PHP client for the WeFact v2 API.
PHP SDK for the Enconvert file conversion API
支付宝开放平台v3协议文档,支持最新版PHP8+
Usgm PHP Library
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-27