1. Go to this page and download the library: Download nova-carnivore/bolt11-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Tag::paymentHash(string $hex): Tag
Tag::paymentSecret(string $hex): Tag
Tag::description(string $text): Tag
Tag::descriptionHash(string $hex): Tag
Tag::payeeNodeKey(string $hex): Tag
Tag::expiry(int $seconds): Tag
Tag::minFinalCltvExpiry(int $blocks): Tag
Tag::fallbackAddress(int $code, string $addressHash): Tag
Tag::routeHint(array $hops): Tag
Tag::featureBits(FeatureBits $bits): Tag
Tag::metadata(string $hex): Tag
enum Network: string {
case Bitcoin = 'bc';
case Testnet = 'tb';
case Signet = 'tbs';
case Regtest = 'bcrt';
}
enum TagType: int {
case PaymentHash = 1;
case PaymentSecret = 16;
case Description = 13;
// ... and more
}
enum Multiplier: string {
case Milli = 'm';
case Micro = 'u';
case Nano = 'n';
case Pico = 'p';
}
use Nova\Bitcoin\Bolt11\Exception\{
Bolt11Exception, // Base exception
InvalidInvoiceException, // Malformed invoice
InvalidChecksumException, // Bad bech32 checksum
InvalidSignatureException, // Signature issues
InvalidAmountException, // Bad amount format
UnsupportedNetworkException, // Unknown network
};
try {
$invoice = Decoder::decode($paymentRequest);
} catch (InvalidChecksumException $e) {
// Bad checksum
} catch (InvalidInvoiceException $e) {
// Malformed invoice
} catch (Bolt11Exception $e) {
// Any BOLT 11 error
}