PHPackages                             lindowx/php-array-hash - 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. lindowx/php-array-hash

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

lindowx/php-array-hash
======================

Hashing an multi-dimension PHP array into a unique value

v0.2.1(4y ago)15.5kMITPHPPHP &gt;=7.3

Since Nov 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lindowx/php-array-hash)[ Packagist](https://packagist.org/packages/lindowx/php-array-hash)[ RSS](/packages/lindowx-php-array-hash/feed)WikiDiscussions main Synced today

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

php-array-hash
==============

[](#php-array-hash)

A PHP array hashing library that can hashing multi-dimension array into a unique string value.

Requirements
------------

[](#requirements)

PHP &gt;= 7.3

Installation
------------

[](#installation)

```
composer require lindowx/php-array-hash
```

Usage
-----

[](#usage)

```
/**
 * Array hashing
 *
 * @param array $arr        The array data you want to hash
 * @param callable $func    Hash algo function
 * @param int $options      Hashing options
 */
Lindowx\PHPArrayHash\ArrayHash::hash(array $arr, callable $func, int $options = 0): string;
```

### Hashing options

[](#hashing-options)

- **ArrayHash::OPT\_NIA\_IGNORE\_ORDER** Ignore the value order when the source array contains num-index lists

### Examples

[](#examples)

```
use Lindowx\PHPArrayHash\ArrayHash;

$arr1 = [
    'a' => 3,
    'b' => 'hello, world',
    'c' => [
        [1, 2, 3],
        [4, 5, 6],
    ],
];

$arr2 = [
    'a' => 3,
    'b' => 'hello, world',
    'c' => [
        [4, 6, 5],
        [3, 1, 2],
    ],
];

// SHA-1 hashing
// 4dea90f136ff0bdeb8da5a7da0f03b1858d62b16
$arrSha1Hash = ArrayHash::hash($arr1, 'sha1');

// MD5 hashing
// 32a02c4310e4c71c27fd5a42b25d0e73
$arrMd5Hash = ArrayHash::hash($arr1, 'md5');

// Custom hashing
//09ce8e0554ed842d50162e28710331415735e7f618b1caa396f28ab0f3cd99d9
$arrCustomHash = ArrayHash::hash($arr1, function ($stub) {
    $key = 'this is a key';
    return hash_hmac('sha256', $stub, $key);
});

// 80895b6e8ab6d0d4d1201f84b3ba8b5f70bb50ea
$arr1Sha1NumIdxListIgnoreOrder = ArrayHash::hash($arr1, 'sha1', ArrayHash::OPT_NIA_IGNORE_ORDER);
// 80895b6e8ab6d0d4d1201f84b3ba8b5f70bb50ea
$arr2Sha1NumIdxListIgnoreOrder = ArrayHash::hash($arr2, 'sha1', ArrayHash::OPT_NIA_IGNORE_ORDER);
```

Testing
=======

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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 ~0 days

Total

2

Last Release

1701d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lindowx-php-array-hash/health.svg)

```
[![Health](https://phpackages.com/badges/lindowx-php-array-hash/health.svg)](https://phpackages.com/packages/lindowx-php-array-hash)
```

###  Alternatives

[kreait/gcp-metadata

Get the metadata from a Google Cloud Platform environment.

654.9M1](/packages/kreait-gcp-metadata)

PHPackages © 2026

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