php-lightning / lnaddress
Fund package maintenance!
0.9.0
2026-07-23 13:53 UTC
Requires
- php: >=8.2
- gacela-project/gacela: ^1.19
- gacela-project/router: ^0.13
- symfony/http-client: ^7.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.75
- gacela-project/phpstan-extension: ^0.4
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^10.5
- psalm/plugin-phpunit: ^0.19
- rector/rector: ^2.0
- vimeo/psalm: ^6.11
This package is auto-updated.
Last update: 2026-08-01 23:27:00 UTC
README
Self-host your own Lightning Address in PHP: a
human-readable identifier like you@yourdomain.com that any Lightning wallet can pay. It
implements LNURL-pay (LUD-06) and is
backend-agnostic — LNbits is the backend available today. Built on
the Gacela framework.
Quick start
Requires PHP >= 8.3 and an LNbits wallet API key.
composer require php-lightning/lnaddress # or clone this repo + composer install cp lightning-config.dist.php lightning-config.php # settings cp backends.dist.json backends.json # per-user invoice backends composer serve # http://localhost:8080
curl 'http://localhost:8080/bob' # → LNURL-pay params curl 'http://localhost:8080/bob?amount=2000' # → bolt11 invoice (2000 millisats)
// lightning-config.php use PhpLightning\Config\LightningConfig; return (new LightningConfig()) ->setDomain('yourdomain.com') ->setReceiver('default-receiver') ->setDescriptionTemplate('Pay to %s') // %s = the lightning address ->setSuccessMessage('Thanks for the payment!') ->setSendableRange(min: 100_000, max: 10_000_000_000) // millisats ->setCallbackUrl('https://yourdomain.com') ->addBackendsFile(getcwd() . '/backends.json');
// backends.json { "bob": { "type": "lnbits", "api_key": "abc...123", "api_endpoint": "http://localhost:5000" }, "alice": { "type": "lnbits", "api_key": "def...456", "api_endpoint": "http://localhost:5000" } }
Wallets resolve bob@yourdomain.com through
https://yourdomain.com/.well-known/lnurlp/bob, so route that path to this app's
/{username} over HTTPS.
Documentation
| Guide | Contents |
|---|---|
| Getting started | Install, configure, run, deploy |
| Configuration | Every setter, defaults, backends file |
| HTTP API | Routes, payloads, CORS, error objects |
| Architecture | Modules, layers, adding a backend |
| Development | Scripts, tests, static analysis, releasing |
Also: project page · CHANGELOG · wiki · demo template
Development
composer test-all # php-cs-fixer + psalm + phpstan + phpunit + rector (dry-run) composer fix # apply php-cs-fixer and rector changes
Contributing
Issues and pull requests are welcome — read
CONTRIBUTING and the
Code of Conduct, and run composer test-all first.
License
MIT — see LICENSE.