PHPackages                             lnpay/php-lndconnect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. lnpay/php-lndconnect

ActiveLibrary[API Development](/categories/api)

lnpay/php-lndconnect
====================

PHP implementation of LNDConnect Spec

1406PHP

Since Jul 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/lnpay/php-lndconnect)[ Packagist](https://packagist.org/packages/lnpay/php-lndconnect)[ RSS](/packages/lnpay-php-lndconnect/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-lndconnect
==============

[](#php-lndconnect)

[![](https://camo.githubusercontent.com/0bfe10aa0127cdc40b9c5fe68c09e65b88d031d16adf489b777102659b5e7d4a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70726f6a6563742d4c4e442d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/lightningnetwork/lnd)[![standard-readme compliant](https://camo.githubusercontent.com/85a8df07cdb7b52c6d19aa103678fed76e6ba8467339b03824405d23c71bf2d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374616e646172642d2d726561646d652d4f4b2d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/RichardLitt/standard-readme)

> Generate and parse lndconnect uris  ⚡️

This package provides utilities for generating and parsing lndconnect uris in PHP.

For more information take a look at the [specification of the uri format](https://github.com/LN-Zap/lndconnect/blob/master/lnd_connect_uri.md).

Table of Contents
-----------------

[](#table-of-contents)

- [Install](#install)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)

Install
-------

[](#install)

```
composer require lnpay/php-lndconnect

```

Usage
-----

[](#usage)

**LndConnect::format($host,$encoded\_cert,$base64url\_macaroon);**

Formats a host / cert / macaroon combo into an lndconnect link.

```
use LndConnect\LndConnect;

LndConnect::format('127.0.0.1:10009','MIICuDCCAl...','AgEDbG5kAus...');

//lndconnect://127.0.0.1:10009?cert=MIICuDCCAl...&macaroon=AgEDbG5kAus...')
```

**LndConnect::encode($host,$raw\_cert,$macaroon\_hex);**

Encodes a host / cert / macaroon combo and formats into an lndconnect link.

```
use LndConnect\LndConnect;

LndConnect::encode('127.0.0.1:10009','-----BEGIN CERTIFICATE-----...','0201036c6...');

//lndconnect://127.0.0.1:10009?cert=MIICuDCCAl...&macaroon=AgEDbG5kAus...')
```

**LndConnect::decode($lndconnect\_uri);**

Decodes an lndconnect link into it's component parts (host / cert as utf8 / macaroon as hex)

```
use LndConnect\LndConnect;

LndConnect::decode('lndconnect://127.0.0.1:10001?cert=MIICDjCCAbSgAwI&macaroon=AgEDbG5');

/*
 * [
 *   'host' => '127.0.0.1:10001',
 *   'cert => '-----BEGIN CERTIFICATE-----.....',
 *   'macaroon'=>'0201036c6....'
 * ]
 */
```

#### Certificate

[](#certificate)

**LndConnect::encodeCert($raw\_cert):**

Encodes a certificate string to base64url encoded DER format.

```
use LndConnect\LndConnect;

LndConnect::encodeCert('-----BEGIN CERTIFICATE-----\n.....');

//MIICDjCCAbSgAwI
```

**LndConnect::decodeCert($lndconnect\_cert):**

Decodes a certificate from base64url encoded DER format to a string.

```
use LndConnect\LndConnect;

LndConnect::decodeCert('MIICDjCCAbSgAwI');

//-----BEGIN CERTIFICATE-----\n.....
```

#### Macaroon

[](#macaroon)

**LndConnect::encodeMacaroon($macaroon\_hex):**

Encodes a binary macaroon hex to base64url encoded string.

```
use LndConnect\LndConnect;

LndConnect::encodeMacaroon('0201036c6...');

//AgEDbG5kAus...
```

**LndConnect::decodeMacaroon($lndconnect\_macaroon):**

Decodes a base64url encoded macaroon to a hex encoded macaroon.

```
use LndConnect\LndConnect;

LndConnect::decodeMacaroon('AgEDbG5kAus...');

//0201036c6...
```

### Testing

[](#testing)

Run the tests suite:

```
  vendor/bin/phpunit
```

Maintainers
-----------

[](#maintainers)

[Tim Kijewski (tkijewski)](https://github.com/tkijewski).

Contribute
----------

[](#contribute)

Feel free to dive in! [Open an issue](https://github.com/lnpay/php-lndconnect/issues/new) or submit PRs.

lndconnect follows the [Contributor Covenant](http://contributor-covenant.org/version/1/3/0/) Code of Conduct.

License
-------

[](#license)

[MIT](LICENSE) © Tim Kijewski

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7f1e80fceb7f978e6648ed1dd83983418347d53478a7b811a6abbf2d781ddc6?d=identicon)[tkthundr](/maintainers/tkthundr)

---

Top Contributors

[![sticktrk](https://avatars.githubusercontent.com/u/3043754?v=4)](https://github.com/sticktrk "sticktrk (3 commits)")

### Embed Badge

![Health badge](/badges/lnpay-php-lndconnect/health.svg)

```
[![Health](https://phpackages.com/badges/lnpay-php-lndconnect/health.svg)](https://phpackages.com/packages/lnpay-php-lndconnect)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
