PHPackages                             kornrunner/rlp - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kornrunner/rlp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kornrunner/rlp
==============

Recursive Length Prefix Encoding in PHP.

0.3.6(3y ago)187.3k↑17.2%1MITPHPPHP ^7.1 | ^8.0 | ^8.1 | ^8.2

Since Feb 9Pushed 3y agoCompare

[ Source](https://github.com/kornrunner/rlp)[ Packagist](https://packagist.org/packages/kornrunner/rlp)[ RSS](/packages/kornrunner-rlp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

rlp [![Tests](https://github.com/kornrunner/rlp/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/kornrunner/rlp/actions/workflows/tests.yml) [![Coverage Status](https://camo.githubusercontent.com/f0c05239503c08d01877d9b83808a3d3fa4265485dd3109b3add31bf9dd07780/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6b6f726e72756e6e65722f726c702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/kornrunner/rlp?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/6435c471cb5250b9f2eab3de61fb6bacce8c319c427d1d2b5d0760ecf2d3a4f8/68747470733a2f2f706f7365722e707567782e6f72672f6b6f726e72756e6e65722f726c702f762f737461626c65)](https://packagist.org/packages/kornrunner/rlp)
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#rlp---)

Recursive Length Prefix Encoding in PHP.

Install
=======

[](#install)

Set minimum stability to dev

```
composer require kornrunner/rlp

```

Usage
=====

[](#usage)

RLP encode:

```
use kornrunner\RLP\RLP;

$rlp = new RLP;
// c483646f67
$encoded = $rlp->encode(['dog']);

// 83646f67
$encoded = $rlp->encode('dog');
```

RLP decode:

```
use kornrunner\RLP\RLP;
use kornrunner\RLP\Types\Str;

$rlp = new RLP;
$encoded = $rlp->encode(['dog']);

// only accept 0x prefixed hex string
$decoded = $rlp->decode('0x' . $encoded);

// show 646f67
echo $decoded[0];

// show dog
echo hex2bin($decoded[0]);

// or you can
echo Str::decodeHex($decoded[0]);
```

API
===

[](#api)

### kornrunner\\RLP\\RLP

[](#kornrunnerrlprlp)

#### encode

[](#encode)

Returns recursive length prefix encoding of given inputs.

`encode(mixed $inputs)`

Mixed inputs - array of string, integer or numeric string.

> Note: output is not zero prefixed.

###### Example

[](#example)

- Encode array of string.

```
use kornrunner\RLP\RLP;

$rlp = new RLP;
$encoded = $rlp->encode(['kornrunner', 'ethereum', 'solidity']);
```

#### decode

[](#decode)

Returns array recursive length prefix decoding of given data.

`decode(string $input)`

String input - recursive length prefix encoded string.

> Note: output is not zero prefixed.

###### Example

[](#example-1)

- Decode recursive length prefix encoded string.

```
use kornrunner\RLP\RLP;
use kornrunner\RLP\Types\Str;

$rlp = new RLP;
$encoded = $rlp->encode(['kornrunner', 'ethereum', 'solidity']);
$decoded = $rlp->decode('0x' . $encoded);

// echo kornrunner
echo hex2bin($decoded[0]);

// echo ethereum
echo hex2bin($decoded[1]);

// echo solidity
echo hex2bin($decoded[2]);

// or you can
echo Str::decodeHex($decoded[0]);
echo Str::decodeHex($decoded[1]);
echo Str::decodeHex($decoded[2]);
```

License
=======

[](#license)

MIT

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.6% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1194d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/725986?v=4)[Boris Momčilović](/maintainers/kornrunner)[@kornrunner](https://github.com/kornrunner)

---

Top Contributors

[![sc0Vu](https://avatars.githubusercontent.com/u/10494397?v=4)](https://github.com/sc0Vu "sc0Vu (73 commits)")[![kornrunner](https://avatars.githubusercontent.com/u/725986?v=4)](https://github.com/kornrunner "kornrunner (2 commits)")[![vincentlg](https://avatars.githubusercontent.com/u/813911?v=4)](https://github.com/vincentlg "vincentlg (2 commits)")[![Bradez](https://avatars.githubusercontent.com/u/919214?v=4)](https://github.com/Bradez "Bradez (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kornrunner-rlp/health.svg)

```
[![Health](https://phpackages.com/badges/kornrunner-rlp/health.svg)](https://phpackages.com/packages/kornrunner-rlp)
```

###  Alternatives

[funct/funct

A PHP library with commonly used code blocks

605141.2k75](/packages/funct-funct)[imanghafoori/laravel-terminator

A minimal yet powerful package to give you opportunity to refactor your controllers.

25353.0k](/packages/imanghafoori-laravel-terminator)[hanson/chinese

简繁体转换.

2317.0k](/packages/hanson-chinese)[maisondunet/module-gtm-cookie-consent

A simple cookie consent module for magento. It relies on new GTM consent functionality.

134.5k](/packages/maisondunet-module-gtm-cookie-consent)

PHPackages © 2026

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