定制 brianhenryie/bh-php-monero-explorer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

brianhenryie/bh-php-monero-explorer

Composer 安装命令:

composer require brianhenryie/bh-php-monero-explorer

包简介

Monero HTTP client.

README 文档

README

PHP 7.4 PHPCS PSR-12 PHPUnit PHPStan

Monero Explorer PHP Client

A thin, strongly typed PHP SDK for Onion Monero Blockchain Explorer instances' HTTP API, e.g. xmrchain.net.

Monero (XMR) is a private, decentralized cryptocurrency, developed with the goals of privacy and security first, ease of use and efficiency second.

Fetching and parsing JSON is very easy with PHP, so this library's value comes from the typed classes and the documentation in PhpDoc. Please contribute clarifications to functions' purposes.

Use

Before v1.0, function signatures are expected to change as they are properly documented.

composer require --fixed brianhenryie/bh-php-monero-explorer@dev

You also need a PSR-7 implementation and a PSR-17 implementation, the most popular being guzzlehttp/guzzle.

ExplorerApi is a direct mapping of API endpoints to PHP functions.

/** @var Psr\Http\Message\RequestFactoryInterface $requestFactory */
$requestFactory = new \GuzzleHttp\Psr7\HttpFactory();
/** @var Psr\Http\Client\ClientInterface $client */
$client = new \GuzzleHttp\Client();

$explorerApi = new \BrianHenryIE\MoneroExplorer\ExplorerApi( $requestFactory, $client );

/** @var \BrianHenryIE\MoneroExplorer\Model\NetworkInfo $networkInfo */
$networkInfo = $explorerApi->getNetworkInfo()

$lastBlockHeight = $networkInfo->getHeight() - 1;

ExplorerTools extends ExplorerApi to add convenience functions.

$explorerTools = new \BrianHenryIE\MoneroExplorer\ExplorerTools( $requestFactory, $client );

$lastBlockHeight = $explorer->getLastBlockHeight();

Accept a Monero payment

To accept a payment with Monero...

  1. Share payment address with customer
  2. Note the blockchain height at that time
  3. Periodically/progressively check new blocks since then inspecting for payment

See: examples/VerifyingPaymentsReceived.php.

Implementation

Initial class-monero-explorer-tools.php extracted from monero-integrations/monerowp.

Goals:

  • Strongly typed: some types are incomplete, some are deserialized as arrays
  • Unit tested: 100% should be achievable on what is just a thin wrapper
  • Use PSR-7 HTTP client | PSR-17 HTTP factory
  • PhpDoc
  • Short tutorial

Notes

  • API is read-only
  • API responses are JSON formatted using the JSend convention

Composer

The required libraries were chosen due to their robust code coverage:

Acknowledgements

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固