Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microlancer/lightning-php
PHP interface for the elements/c-lightning RPC API
https://github.com/microlancer/lightning-php
bitcoin c-lightning lightning-network
Last synced: 8 days ago
JSON representation
PHP interface for the elements/c-lightning RPC API
- Host: GitHub
- URL: https://github.com/microlancer/lightning-php
- Owner: microlancer
- License: mit
- Created: 2018-10-26T01:19:08.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-26T02:05:10.000Z (about 6 years ago)
- Last Synced: 2024-08-06T01:18:51.663Z (3 months ago)
- Topics: bitcoin, c-lightning, lightning-network
- Language: PHP
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-lightning-network - lightning-php - PHP client for direct RPC-based access to the c-lightning daemon (Developer Resources / Libraries)
README
# lightning-php
PHP interface for the elements/c-lightning RPC API## Installation
`composer require thorie7912/lightning-php:^1.0`
## Usage
```php
$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);
```