PHPackages                             blockchainethdev/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. blockchainethdev/rlp

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

blockchainethdev/rlp
====================

Recursive Length Prefix Encoding in PHP.

0.3.4(2y ago)02711MITPHPPHP ^7.1 | ^8.0

Since Dec 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/blockchainethdev/rlp)[ Packagist](https://packagist.org/packages/blockchainethdev/rlp)[ RSS](/packages/blockchainethdev-rlp/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

rlp
===

[](#rlp)

[![PHP](https://github.com/blockchainethdev/rlp/actions/workflows/php.yml/badge.svg)](https://github.com/web3p/rlp/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/a90689b8a7ae7b70db3d75a404e2c46562e176cf74e7d2a8e30107e7d2ef33f7/68747470733a2f2f636f6465636f762e696f2f67682f626c6f636b636861696e6574686465762f726c702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/web3p/rlp)[![Licensed under the MIT License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://github.com/blockchainethdev/rlp/blob/master/LICENSE)

Recursive Length Prefix Encoding in PHP.

Install
=======

[](#install)

Set minimum stability to dev

```
composer require blockchainethdev/rlp

```

Usage
=====

[](#usage)

RLP encode:

```
use Blockchainethdev\RLP\RLP;

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

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

RLP decode:

```
use Blockchainethdev\RLP\RLP;
use Blockchainethdev\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)

### Blockchainethdev\\RLP\\RLP

[](#blockchainethdevrlprlp)

#### 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 Blockchainethdev\RLP\RLP;

$rlp = new RLP;
$encoded = $rlp->encode(['blockchainethdev', '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 Blockchainethdev\RLP\RLP;
use Blockchainethdev\RLP\Types\Str;

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

// echo blockchainethdev
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

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

906d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/155134091?v=4)[blockchainethdev](/maintainers/blockchainethdev)[@blockchainethdev](https://github.com/blockchainethdev)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[awes-io/navigator

🧿 Build navigation or menu for Laravel and Awes.io. Unlimit complexity and depth of the menu.

4922.8k](/packages/awes-io-navigator)

PHPackages © 2026

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