PHPackages                             tinson/php-consistent-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. tinson/php-consistent-hash

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

tinson/php-consistent-hash
==========================

PHP Consistent Hash Library

v1.0.3(6y ago)05MITPHPPHP &gt;=5.6CI failing

Since Sep 26Pushed 6y agoCompare

[ Source](https://github.com/hetiansu5/php-consistent-hash)[ Packagist](https://packagist.org/packages/tinson/php-consistent-hash)[ RSS](/packages/tinson-php-consistent-hash/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Introduction
------------

[](#introduction)

The Project is a PHP Library which implements consistent hash.

Quick Start
-----------

[](#quick-start)

```
    # New an instance
    # 构建一个实例
    $builder = new Builder();

    # add server node (server_dsn, server_tag, weight)
    # 添加服务器节点
    $tag1 = 1;
    $tag2 = 2;
    $tag3 = 3;
    $builder->addServer('host1:6379', $tag1, 1);
    $builder->addServer('host2:6379', $tag2, 1);
    $builder->addServer('host3:6379', $tag3, 2);

    # set virtual node's number. It means that one real server node will be mapping many virtual nodes
    # 设置虚拟节点数，表示：1个实际的服务器节点会映射成多个虚拟节点，确保服务器节点可以实现均匀分布
    $builder->setVirtualNodeNum(128);

    # initialize server nodes, generate virtual nodes array for search
    # 初始化服务器节点，生成后续用于查找的虚拟节点数组
    $builder->initNodes();

    # search the mapping server_tag for input key
    # 查询输入key映射的服务器tag标识
    $tag = $builder->search("my:hts1");

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Every ~0 days

Total

3

Last Release

2423d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42daf3795861a699f5e94b392d00321706c16983a502315f1c9a29655cdfe347?d=identicon)[hetiansu5](/maintainers/hetiansu5)

---

Top Contributors

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

---

Tags

phpconsistent hashredis hashmemcached hashcache hash

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tinson-php-consistent-hash/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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