tsukiro / buda-sdk
本项目的目的是生成一个PHP SDK,用于使用Buda.com网站的服务端点
3.3
2021-05-23 07:30 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0.0
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-09-05 13:44:23 UTC
README
描述
本项目的目的是生成一个PHP SDK,用于使用Buda.com网站的服务端点。目前该项目使用Tsukiro的Codegen生成,未来版本可能会进行更改。
要求
PHP 5.5 及以上版本
安装与使用
Composer
您可以使用Composer(v2)安装此项目。
您可以将以下命令行添加到您的 composer.json
文件中
{
"require": {
"tsukiro/buda-sdk": "*@dev"
}
}
然后执行 composer install
测试
运行单元测试
composer install
./vendor/bin/phpunit
入门指南
在完成安装和使用的步骤后,您可以执行以下操作
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new Tsukiro\Client\Api\BudaApi(); try { $apiInstance->setApiKey("YOUR_APIKEY"); $apiInstance->setSecret("YOUR_SECRET"); $response = $apiInstance->getBalance(); list($body, $statusCode, $headers) = $response; } catch (Exception $e) { echo 'Exception when calling BudaApi->apiV2BalancesGet: ', $e->getMessage(), PHP_EOL; } $apiInstance = new Tsukiro\Client\Api\BudaApi(); try { $response = $apiInstance->getMarkets(); list($markets, $statusCode, $headers) = $response; } catch (Exception $e) { echo 'Exception when calling BudaApi->getMarkets: ', $e->getMessage(), PHP_EOL; } $apiInstance = new Tsukiro\Client\Api\BudaApi(); $market_id = "market_id_example"; // string | Market ID obtenido desde le metodo getMarkets o desde tu base de datos try { $response = $apiInstance->getTicker($market_id); list($ticker, $statusCode, $headers) = $response; } catch (Exception $e) { echo 'Exception when calling BudaApi->apiV2MarketsMarketIdTickerGet: ', $e->getMessage(), PHP_EOL; } ?>
API端点文档
所有URI相对于 https://www.buda.com
授权文档
对于需要认证的路由,例如getBalances,您需要设置您的apikey和secret。自动生成的函数将生成必要的nonce和signature,以便与Buda端点通信。
$apiInstance->setApiKey("YOUR_APIKEY");
$apiInstance->setSecret("YOUR_SECRET");