utxo-one/lnd-php

An opinionated SDK for lncli commands via PHP

v0.1.3 2023-01-18 19:03 UTC

This package is auto-updated.

Last update: 2024-05-18 22:00:44 UTC


README

A PHP SDK for the LND implementation of the Lightning Network

Installation

composer require utxo-one/lnd-php

Usage

use UtxoOne\LndPhp\Services\LightningService;

// Initialize an LND Instance.
$lightningService = new LightningService(
    host: $this->host,
    port: $this->port,
    macaroonHex: $this->macaroonHex,
    tlsCertificat: $this->tlsCertificate,
);

// Execute a command. ie getinfo
$nodeInfo = $lightningService->getInfo();

// Get the results
$nodeInfo->getVersion();
$nodeInfo->getCommitHash();
$nodeInfo->getIdentityPubkey();
$nodeInfo->getAlias();
$nodeInfo->getNumPendingChannels();
$nodeInfo->getNumActiveChannels();
$nodeInfo->getNumPeers();
$nodeInfo->getBlockHash();
$nodeInfo->getBlockHeight();
$nodeInfo->getUris();
$nodeInfo->getBestHeaderTimestamp();
$nodeInfo->isSyncedToChain();
$nodeInfo->isTestnet();
$nodeInfo->requiresHtlcInterceptor();

Available Methods

// Lightning Service
$lightningService->getInfo();
$lightningService->abandonChannel();
$lightningService->addInvoice();
$lightningService->bakeMacaroon();
$lightningService->batchOpenChannel();
$lightningService->channelAcceptor();
$lightningService->channelBalance();
$lightningService->checkMacaroonPermissions();
$lightningService->closeChannel();
$lightningService->closedChannels();
$lightningService->lookupInvoice();
$lightningService->sendCoins();
$lightningService->sendMany();
$lightningService->getInfo();

// WalletKit Service
$walletKitService->nextAddr();
$walletKitService->listAddresses();
$walletKitService->listUnspent();