1. Go to this page and download the library: Download utxo-one/lnd-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
utxo-one / lnd-php example snippets
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->