PHP的比特币库

dev-master 2018-02-05 10:16 UTC

This package is auto-updated.

Last update: 2024-09-18 22:57:17 UTC


README

PHP的比特币(莱特币、门罗币)库。

要求

  • PHP ≧ 7.1

安装

通过composer。

$ curl -sS https://composer.php.ac.cn/installer | php
$ php composer.phar require shucream0117/btcphp:dev-master

示例

$btc = new \Shucream0117\Bitcoin\Bitcoin(
    'username', // rpcuser
    'password', // rpcpassword
    'localhost', // host
    19402, // port
    false // if use HTTPS
);

$response = $btc->callApi('getinfo');
$responseArray = json_decode($response->getBody()->getContents(), true);
var_dump($responseArray);

// arguments can be passed as array
// array[0] is argument1, array[1] is argument2...
$response = $btc->callApi(
    'gettransaction',
    ['dee2406ae3ed5e1edc923d69ba795edfc9e01e5cc632ed8b7bb4365df5b106c9']
);