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

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

xiangdangdang/rlp
=================

Recursive Length Prefix Encoding in PHP.

0.3.5(4y ago)06031MITPHP &gt;=5.6

Since Feb 1Pushed 4y agoCompare

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

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

rlp
===

[](#rlp)

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

Recursive Length Prefix Encoding in PHP.

Install
=======

[](#install)

Set minimum stability to dev

```
composer require web3p/rlp

```

Usage
=====

[](#usage)

RLP encode:

```
use Web3p\RLP\RLP;

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

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

RLP decode:

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

### Web3p\\RLP\\RLP

[](#web3prlprlp)

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

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

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

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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

Every ~126 days

Recently: every ~282 days

Total

11

Last Release

1756d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4e7f8b1faaa6eb6883ab6b21bbaa50e23031fb711c1d12480f11a88e79c527f?d=identicon)[Xiang-DangDang](/maintainers/Xiang-DangDang)

---

Top Contributors

[![sc0Vu](https://avatars.githubusercontent.com/u/10494397?v=4)](https://github.com/sc0Vu "sc0Vu (67 commits)")[![olegabr](https://avatars.githubusercontent.com/u/2850808?v=4)](https://github.com/olegabr "olegabr (9 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/xiangdangdang-rlp/health.svg)

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

###  Alternatives

[farhanwazir/laravelgooglemaps

Laravel Google Map package for 5.x. You can use all google map features in laravel.

15542.0k2](/packages/farhanwazir-laravelgooglemaps)

PHPackages © 2026

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