Use the lnaddress
to be able to get a callback url and request an invoice from your server.
This demo shows that the entire library works by using the library code + with custom configuration in your own lightning-config.php
.
composer init
composer require php-lightning/lnaddress
https://github.com/php-lightning/demo-lnaddress/generate
composer install
The configuration is set up in nostr.json
at the root of the project.
cp nostr.dist.json nostr.json
- Set up the API-KEY:
For example, create your own wallet https://demo.lnbits.com/ and set up your own api_key.
- Start your server:
php -S localhost:8080 vendor/php-lightning/lnaddress/public/index.php
- Get a callback url and lightning server configuration. Request without any GET params:
http://localhost:8080/
- Request an invoice from your server (in milli-sats). Request using amount as GET param:
http://localhost:8080/alice?amount=100000