2017 © Pedro Peláez
 

library lightning-charge-client-php

PHP client for the Lightning Charge REST API

image

elementsproject/lightning-charge-client-php

PHP client for the Lightning Charge REST API

  • Thursday, January 25, 2018
  • by shesek
  • Repository
  • 10 Watchers
  • 12 Stars
  • 77 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 3 Versions
  • 20 % Grown

The README.md

lightning-charge-client-php

PHP client for the Lightning Charge REST API., (*1)

Install

$ composer require elementsproject/lightning-charge-client-php

Use

<?php
require_once 'vendor/autoload.php';

// Initialize client
$charge = new LightningChargeClient('http://localhost:8009', '[TOKEN]');

// Create invoice
$invoice = $charge->invoice([ 'msatoshi' => 50, 'metadata' => [ 'customer' => 'Satoshi', 'products' => [ 'potato', 'chips' ] ] ]);

tell_user("to pay, send $invoice->msatoshi milli-satoshis with rhash $invoice->rhash, or copy the BOLT11 payment request: $invoice->payreq");

// Create invoice denominated in USD
$invoice = $charge->invoice([ 'currency' => 'USD', 'amount' => 0.15 ]);

// Fetch invoice by id
$invoice = $charge->fetch('m51vlVWuIKGumTLbJ1RPb');

// Fetch all invoices
$invoice = $charge->fetchAll();

// Register web hook
$charge->registerHook('m51vlVWuIKGumTLbJ1RPb', 'http://my-server.com/my-callback-url');

TODO: document wait, (*2)

Test

$ CHARGE_URL=http://api-token:[TOKEN]@localhost:8009 phpunit test

License

MIT, (*3)

The Versions

25/01 2018

dev-master

9999999-dev

PHP client for the Lightning Charge REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

29/12 2017

0.1.3

0.1.3.0

PHP client for the Lightning Charge REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

09/12 2017

0.1.2

0.1.2.0

PHP client for the Lightning Strike REST API

  Sources   Download

MIT

The Requires

 

The Development Requires