cpsit/myra-web-api
Composer 安装命令:
composer require cpsit/myra-web-api
包简介
Php implementation of the myracloud.com api
关键字:
README 文档
README
- PHP: ^8.1
- guzzlehttp/guzzle: ^7.8
- s1lentium/iptools: ^1.2
- symfony/console: ^6.4 || ^7.0
- symfony/yaml: ^6.4 || ^7.0
Myra PHP Web API Client
What is this?
This library implements a minimal API layer on top of guzzlehttp/guzzle to access the Myra Web API.
You can either use the WebApi Class to access a number of predefined endpoints or use the Signature Middleware with your own GuzzleHttp/Guzzle instance, to transparently handle authentication and signing of requests.
When using the endpoints please remember that these are very thin abstractions, so they will return plain arrays with result data. Errors and Exceptions from either Guzzle or the API will have to be handled in you code.
For more flexibility, you can use a GuzzleHttp/Guzzle instance to access the API endpoint directly. In this case you can simply attach the signature middleware to handle Authentication headers as seen in WebApi::_construct()
$signature = new Signature($secret, $apiKey);
$stack->push(
Middleware::mapRequest(
function (RequestInterface $request) use ($signature) {
return $signature->signRequest($request);
}
)
);
This package also contains a commandline client for most API endpoints. use 'php bin/console list' to list all supported command. Use --help for usage details.
php bin/console myracloud:api:dns -k <apiKey> -s <apiSecret> -o list <domain>
Installation
Install Composer (https://getcomposer.org/download/)
As Library via Composer:
composer require cpsit/myra-web-api
As CLI Client:
composer install --no-dev
usage
You can create a config.php file in the application root to save your access keys:
<?php // cli usage return [ 'apikey' => '##APIKEY##', 'secret' => '##SECRET##', 'endpoint' => 'api.myracloud.com' // optional ];
direct credentals in CLI
# all arguments for the connection are optional of provided by the config.php except the endpoint this one is always optional > ./bin/console myracloud:api:dns --apiKey=api_token_key --secret=api_secret --endpoint=api.myracloud.com mydomain.com # OR > ./bin/console myracloud:api:dns -k api_token_key -s api_secret -e api.myracloud.com mydomain.com
or use the Myracloud\WebApi\WebApi directly
$myraApi = new Myracloud\WebApi\WebApi( apiKey: 'api_token_key', // provided from myracloud.com secret: 'api_secret', // provided from myracloud.com site: 'api_endpoint_domain',// leave empty to use default: 'api.myracloud.com' lang: 'api_endpoint_lang', // leave empty to use default: 'en' connectionConfig: [], // connectionConfig for guzzleClient, with this can every default config be overwritten (default: base_uri, handler) requestHandler: null // custom request handler, default is GuzzleHttp\Handler\CurlHandler used in guzzle/HandlerStack, can be replaced for example with a MockHandler for testing ); // example print_r($myraApi->getDnsRecordEndpoint()->getList());
cpsit/myra-web-api 适用场景与选型建议
cpsit/myra-web-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 644 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「myracloud」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cpsit/myra-web-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cpsit/myra-web-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cpsit/myra-web-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Framework agnostic php implementation of the latest myracloud.com cdn api
A PSR-7 compatible library for making CRUD API endpoints
Php implementation of the myracloud.com api
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
统计信息
- 总下载量: 644
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-06