项目作者: thorie7912

项目描述 :
PHP interface for the elements/c-lightning RPC API
高级语言: PHP
项目地址: git://github.com/thorie7912/lightning-php.git
创建时间: 2018-10-26T01:19:08Z
项目社区:https://github.com/thorie7912/lightning-php

开源协议:MIT License

下载


lightning-php

PHP interface for the elements/c-lightning RPC API

Installation

composer require thorie7912/lightning-php:^1.0

Usage

  1. $lightningApi = new \Lightning\LightningApi();
  2. $lightningApi->setRpcFile("/home/user/.lightning/lightning-rpc");
  3. // Get info
  4. $json = $lightningApi->getInfo();
  5. echo json_encode($json, JSON_PRETTY_PRINT);
  6. // Pay invoice
  7. $invoice = "ln123xyz...";
  8. $json = $lightningApi->pay($invoice);
  9. echo json_encode($json, JSON_PRETTY_PRINT);
  10. // Create invoice
  11. $msatoshi = 50000;
  12. $label = "Some label";
  13. $description = "Some description";
  14. $json = $lightningApi->createinvoice($msatoshi, $label, $description);
  15. echo json_encode($json, JSON_PRETTY_PRINT);