thorie7912/lightning-php

PHP 接口用于 elements/c-lightning RPC API

v1.0.3 2018-10-26 02:04 UTC

This package is auto-updated.

Last update: 2024-09-26 15:22:42 UTC


README

PHP 接口用于 elements/c-lightning RPC API

安装

composer require thorie7912/lightning-php:^1.0

使用

$lightningApi = new \Lightning\LightningApi();
$lightningApi->setRpcFile("/home/user/.lightning/lightning-rpc");

// Get info

$json = $lightningApi->getInfo();
echo json_encode($json, JSON_PRETTY_PRINT);

// Pay invoice

$invoice = "ln123xyz...";
$json = $lightningApi->pay($invoice);
echo json_encode($json, JSON_PRETTY_PRINT);

// Create invoice

$msatoshi = 50000;
$label = "Some label";
$description = "Some description";
$json = $lightningApi->createinvoice($msatoshi, $label, $description);
echo json_encode($json, JSON_PRETTY_PRINT);