ezadr/lnurl-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ezadr/lnurl-php

最新稳定版本:1.0.1

Composer 安装命令:

composer require ezadr/lnurl-php

包简介

PHP implementation of LNURL Spec, including LNURL Auth

README 文档

README

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

This repo is a fork of: https://github.com/tkijewski/php-lnurl. I have improved the code, added testing and PHP8 support, and more importantly I added support for lnurl-auth (https://github.com/fiatjaf/lnurl-rfc/blob/luds/04.md).

Installation

$ composer require ezadr/lnurl-php

Usage

I have also written an article on how you could potentially implement this in your own PHP application here https://zadrima.com/lnurl-auth-in-php/

<?php

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

use eza\lnurl;

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

// Decode from LNURL
print_r( lnurl\decodeUrl($lnurl) );
/*
 * [
 *   'url' => 'https://paywall.link?someIdentifier=292e29j29j19nd91m2mfmmurn843&tag=withdraw',
 *   'tag' => 'withdraw'
 *   'someIdentifier' => '292e29j29j19nd91m2mfmmurn843'
 * ] 
 */
 
// LNURL Auth
if (lnurl\auth($request->k1, $request->signature, $request->wallet_public_key)) {
    // fetch or create user then authenticate
}

Test

$ vendor/bin/phpunit

统计信息

  • 总下载量: 3.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: DBAD
  • 更新时间: 2022-05-08