PHPackages                             richjenks/merkle - 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. richjenks/merkle

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

richjenks/merkle
================

Generate Merkle Trees following the same method used by Bitcoin

v1.0.1(7y ago)012MITPHP

Since Mar 16Pushed 7y agoCompare

[ Source](https://github.com/richjenks/merkle)[ Packagist](https://packagist.org/packages/richjenks/merkle)[ RSS](/packages/richjenks-merkle/feed)WikiDiscussions master Synced yesterday

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

Merkle Tree
===========

[](#merkle-tree)

Generates the Merkle Root for any data

Usage
=====

[](#usage)

Install with [Composer](https://getcomposer.org) via `composer require richjenks/merkle` then:

```
require 'vendor/autoload.php';
use RichJenks\Merkle\Merkle;

$data = [
	'8c14f0db3df150123e6f3dbbf30f8b955a8249b62ac1d1ff16284aefa3d06d87',
	'fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4',
	'6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4',
	'e9a66845e05d5abc0ad04ec80f774a7e585c6e8db975962d069a522137b80c1d',
];

$root = Merkle::root($data);
// 6657A9252AACD5C0B2940996ECFF952228C3067CC38D4885EFB5A4AC4247E9F3

if ($merkle::verify($root, $data)) {
	// Data hasn't been tampered with
} else {
	// Naughty naughty...
}
```

Inputs don't have to be hexadecimal representations of double-SHA256 outputs, they are simply the most common use-case.

Endianness
==========

[](#endianness)

This library assumes that its inputs will be in big-endian format, i.e. the same as would be visible on a blockchain explorer. If you want to use this library for anything bitcoin-related then please be aware that you'll need to account for endianness when creating transaction hashes. See [https://en.bitcoin.it/wiki/Block\_hashing\_algorithm#Endianess](https://en.bitcoin.it/wiki/Block_hashing_algorithm#Endianess) for details.

If you're using this library for anything else then you can safely ignore this section.

Tests
-----

[](#tests)

Tests can be run with the `composer test` command.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~1 days

Total

2

Last Release

2613d ago

### Community

Maintainers

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

---

Top Contributors

[![richjenks](https://avatars.githubusercontent.com/u/1795615?v=4)](https://github.com/richjenks "richjenks (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/richjenks-merkle/health.svg)

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

PHPackages © 2026

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