netborg / bitbay-api-client
BitBay.net加密货币交易平台PHP公共API客户端。
v1.2.0
2018-01-25 22:17 UTC
Requires
- php: >=7.1
- php-curl-class/php-curl-class: ^8.0
This package is auto-updated.
Last update: 2024-08-29 04:31:33 UTC
README
这是一个免费的PHP 公共API v2.0 和 私有API 客户端,用于BitBay.net加密货币交易平台。
需求
- PHP: 7.1+;
- PHP CURL模块;
- Redis(可选);
安装
composer require netborg/bitbay-api-client
使用示例
向公共API发起请求的示例
$client = new \Netborg\Bitbay\PublicClient();
$response = $client->execute(\Netborg\Bitbay\Category::ALL, 'BTC', 'PLN');
向私有API发起请求的示例
$client = new \Netborg\Bitbay\PrivateClient("[API_KEY]", "[SECRET]");
// get User's wallet with all currency accounts
$wallet = $client->getWallet();
// get User's wallet with selected currency
$wallet = $client->getWallet('BTC');
// execute raw request to BitBay.net private API
$response = $client->execute("info", ["currency" => "BTC"]);
Redis支持
此功能尚未完全实现。
您可以选择使用Redis进行快速缓存。在这种情况下,请添加predis/predis
库
composer require predis/predis
在config
目录中找到配置文件。或者,您可以设置Redis驱动程序
\Netborg\Bitbay\PublicClient::redis('predis', [
'host' => 'localhost',
'password' => null,
'port' => 6379,
'database' => 0,
]);
$client = new \Netborg\Bitbay\PublicClient();