tkijewski/php-lnurl

PHP implementation of lnurl Spec

v0.0.1 2019-08-26 04:16 UTC

This package is auto-updated.

Last update: 2024-10-20 21:54:11 UTC


README

PHP implementation of the lnurl protocol https://github.com/fiatjaf/lnurl-rfc

Uses the bech32 library https://github.com/Bit-Wasp/bech32

Installation

$ composer require tkijewski/php-lnurl

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use tkijewski\lnurl;

$lnurl = lnurl\encodeUrl('https://paywall.link?someIdentifier=292e29j29j19nd91m2mfmmurn843&tag=withdraw');
//LNURL1DP68GURN8GHJ7URP09MKZMRV9EKXJMNT8AEK7MT9F9JX2MN5D9NXJETJ85ERJVN9XGUK5V3EDGCNJMNY8YCK6VNDVEKK6ATJDCURGVEXW3SKW0THD96XSERJV9MS95LDUW


print_r( lnurl\decodeUrl($lnurl) );
/*
 * [
 *   'url' => 'https://paywall.link?someIdentifier=292e29j29j19nd91m2mfmmurn843&tag=withdraw',
 *   'tag' => 'withdraw'
 *   'someIdentifier' => '292e29j29j19nd91m2mfmmurn843'
 * ] 
 */

Test

$ vendor/bin/phpunit