bpx-network / bpx-beacon-php
BPX Beacon Client RPC API 的官方 PHP 封装
1.0.0
2023-05-02 13:22 UTC
Requires
- php: >=7.0
- ext-curl: *
README
BPX Beacon Client RPC API 的官方 PHP 封装
安装
composer require bpx-network/bpx-beacon-php
要求
- PHP >= 7.0
- cURL
用法
查看 examples/ 文件夹以获取更多用法示例。
<?php require __DIR__ . '/vendor/autoload.php'; try { $beacon = new BPX\Beacon('localhost', 8201, 'C:\private_beacon.crt', 'C:\private_beacon.key'); $farmer = new BPX\Farmer('localhost', 8204, 'C:\private_farmer.crt', 'C:\private_farmer.key'); $harvester = new BPX\Harvester('localhost', 8205, 'C:\private_harvester.crt', 'C:\private_harvester.key'); $crawler = new BPX\Crawler('localhost', 8206, 'C:\private_crawler.crt', 'C:\private_crawler.key'); var_dump( $beacon -> getBlockchainState() ); var_dump( $farmer -> getRewardTargets(true) ); $harvester -> refreshPlots(); var_dump( $crawler -> getPeerCounts() ); } catch(BPX\Exceptions\ConnException $e) { echo "Connection error: " . $e->getMessage(); } catch(BPX\Exceptions\BPXException $e) { echo "BPX error: " . $e->getMessage(); } ?>