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

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

zhujinkui/rlp
=============

Recursive Length Prefix Encoding in PHP.

1.0.0(1y ago)0151MITPHPPHP ^7.1 | ^8.0

Since Jul 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/zhujinkui/rlp)[ Packagist](https://packagist.org/packages/zhujinkui/rlp)[ RSS](/packages/zhujinkui-rlp/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)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 zhujinkui/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

24

—

LowBetter than 31% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

709d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/36879659?v=4)[朱金奎](/maintainers/zhujinkui)[@zhujinkui](https://github.com/zhujinkui)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jeremykenedy/uuid

Laravel package to generate a UUID according to the RFC 4122 standard. UUID Versions 1, 3, 4 and 5 are supported. With MIT license.

23136.8k](/packages/jeremykenedy-uuid)

PHPackages © 2026

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