channelengine / channel-api-client-php
适用于渠道的ChannelEngine API
2.13.0
2022-09-09 09:46 UTC
Requires
- php: ^7.3 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpunit/phpunit: ^8.0 || ^9.0
README
Channel API客户端库的弃用
此库不再由ChannelEngine支持。要使用您选择的编程语言通过OpenAPI Generator构建自己的库,请查看我们帮助中心中的Channel API: API客户端文章。
ChannelEngine的API遵循OpenAPI/Swagger规范,您可以在我们的API参考中找到这些规范。(在swagger页面顶部切换到'ChannelEngine Channel API')
开发者附加信息
有关ChannelEngine的API的详细信息,请访问我们帮助中心的REST APIs分类。
安装与使用
Composer
要使用Composer安装绑定,请将以下内容添加到composer.json
{
"require": {
"channelengine/channel-api-client-php": "*"
}
}
然后运行composer install
入门指南
请按照安装过程进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); use ChannelEngine\ApiClient\Configuration; use ChannelEngine\ApiClient\ApiException; use ChannelEngine\ApiClient\Api\OrderApi; $apiConfig = Configuration::getDefaultConfiguration(); $apiConfig->setHost('https://demo.channelengine.net/api'); $apiConfig->setApiKey('apikey', 'xxxxxxxxxxxx'); $orderApi = new OrderApi(null, $apiConfig); try { $response = $orderApi->orderGetNew(); dd($response); } catch (ApiException $e) { // In case of a non-2xx status an exception will be trown. // However, we can check getResponseBody() to get the deserialized response. echo($e->getMessage()); dd($e->getResponseBody()); } function dd($var) { echo("<pre>"); print_r($var); echo("</pre>"); }