Download the PHP package nova-carnivore/bolt11-php without Composer
On this page you can find all versions of the php package nova-carnivore/bolt11-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download nova-carnivore/bolt11-php
More information about nova-carnivore/bolt11-php
Files in nova-carnivore/bolt11-php
Download nova-carnivore/bolt11-php
More information about nova-carnivore/bolt11-php
Files in nova-carnivore/bolt11-php
Vendor nova-carnivore
Package bolt11-php
Short Description Modern PHP 8.3+ BOLT 11 Lightning Network invoice encoder/decoder
License MIT
Package bolt11-php
Short Description Modern PHP 8.3+ BOLT 11 Lightning Network invoice encoder/decoder
License MIT
Please rate this library. Is it a good library?
Informations about the package bolt11-php
bolt11-php
Modern PHP 8.3+ BOLT 11 Lightning Network invoice encoder/decoder. Full spec compliance, production-ready.
Features
- โก Full BOLT 11 spec compliance โ All 12 spec test vectors pass
- ๐ Encode, sign & decode โ Complete lifecycle support
- ๐๏ธ Modern PHP 8.3+ โ Enums, readonly classes, named arguments, match expressions
- ๐ PHPStan level 9 + Psalm errorLevel 1 โ Maximum static analysis strictness from two analyzers
- ๐ All networks โ Bitcoin, Testnet, Signet, Regtest
- ๐ท๏ธ All tag types โ payment_hash, description, route hints, feature bits, metadata, and more
- ๐ Round-trip safe โ Encode โ sign โ decode preserves all data
- ๐ PSR-12 code style โ Enforced with PHP-CS-Fixer
- ๐ Audited crypto dependency โ Uses paragonie/ecc for ECDSA operations
Installation
Requirements
- PHP 8.3 or higher
- ext-gmp (required by paragonie/ecc)
Quick Start
Decode an Invoice
Encode an Invoice
Sign an Invoice
Amount Helpers
API Reference
Decoder::decode(string $paymentRequest): Invoice
Decodes a BOLT 11 payment request string into an Invoice object. Handles both lowercase and UPPERCASE invoices.
Encoder::encode(...): Invoice
Creates an unsigned invoice. Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
network |
Network |
Network::Bitcoin |
Target network |
satoshis |
?int |
null |
Amount in satoshis |
millisatoshis |
?string |
null |
Amount in millisatoshis |
tags |
array<Tag> |
[] |
Tagged fields |
timestamp |
?int |
null |
Unix timestamp (defaults to now) |
Signer::sign(Invoice $invoice, string $privateKeyHex): Invoice
Signs an unsigned invoice with a secp256k1 private key.
Invoice (Value Object)
| Property | Type | Description |
|---|---|---|
complete |
bool |
Whether the invoice is fully signed |
prefix |
string |
Full HRP (e.g. lnbc2500u) |
network |
?Network |
Bitcoin network enum |
satoshis |
?int |
Amount in satoshis |
millisatoshis |
?string |
Amount in millisatoshis |
timestamp |
int |
Unix timestamp |
payeeNodeKey |
?string |
Compressed public key (hex) |
signature |
string |
64-byte compact signature (hex) |
recoveryFlag |
int |
Signature recovery flag (0-3) |
tags |
array<Tag> |
All tagged fields |
paymentRequest |
?string |
Full bech32-encoded string |
Tag Factory Methods
Enums
BOLT 11 Spec Compliance
All 12 official test vectors pass:
| # | Test | Status |
|---|---|---|
| 1 | Donation (any amount) | โ |
| 2 | $3 coffee (2500ยต, 60s expiry) | โ |
| 3 | UTF-8 description (ใใณใปใณใน 1ๆฏ) | โ |
| 4 | Hashed description (20m) | โ |
| 5 | Testnet with P2PKH fallback | โ |
| 6 | Mainnet with P2PKH + route hints | โ |
| 7 | Feature bits (8, 14, 99) | โ |
| 8 | Uppercase invoice | โ |
| 9 | Metadata (0x01fafaf0) | โ |
| 10 | Pico-BTC amount (9678785340p) | โ |
| 11 | High-S signature recovery | โ |
| 12 | Unknown tags (silently ignored) | โ |
Supported Tagged Fields
| Code | Letter | Field | Supported |
|---|---|---|---|
| 1 | p |
payment_hash | โ |
| 16 | s |
payment_secret | โ |
| 13 | d |
description | โ |
| 27 | m |
metadata | โ |
| 19 | n |
payee node key | โ |
| 23 | h |
description_hash | โ |
| 6 | x |
expiry | โ |
| 24 | c |
min_final_cltv_expiry | โ |
| 9 | f |
fallback address | โ |
| 3 | r |
route hints | โ |
| 5 | 9 |
feature bits | โ |
Exception Handling
Development
Architecture
License
MIT โ see LICENSE.
All versions of bolt11-php with dependencies
PHP Build Version
Package Version
The package nova-carnivore/bolt11-php contains the following files
Loading the files please wait ...