PHPackages                             bybzmt/numbergenerator - 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. bybzmt/numbergenerator

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

bybzmt/numbergenerator
======================

generator unique rand number

v1.0.2(9y ago)032Apache-2.0PHPPHP &gt;=5.3.0

Since Jul 31Pushed 9y ago2 watchersCompare

[ Source](https://github.com/bybzmt/NumberGenerator)[ Packagist](https://packagist.org/packages/bybzmt/numbergenerator)[ Docs](http://github.com/bybzmt/numbergenerator)[ RSS](/packages/bybzmt-numbergenerator/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (4)Used By (0)

\#NumberGenerator

NumberGenerator是一个数字生成器，用来生成一段不重复的数字

可以用来生成随机id。 比如：给用户分配一个随机的id，要求id必需1000000 - 9999999之间。

- SpaceManager 是算法核心
- SlotManager 用来按SpaceManager分slot来进行持久化操作

需要注意的时Persistent里面需要有加锁功能，如果没有合适的锁可以使用 [bybzmt/tcplock](https://github.com/bybzmt/tcplock)

composer安装:

`composer require "bybzmt/numbergenerator"`

/example 目录里有用法示例

[![算法示例](https://raw.githubusercontent.com/bybzmt/NumberGenerator/master/example/principle.png)](https://raw.githubusercontent.com/bybzmt/NumberGenerator/master/example/principle.png)

如上图a0表示b0-b2是否己用b0表示c0-c2是否己用，类推

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3620d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1188099?v=4)[bybzmt](/maintainers/bybzmt)[@bybzmt](https://github.com/bybzmt)

---

Top Contributors

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

---

Tags

numbergeneratorunique rand number

### Embed Badge

![Health badge](/badges/bybzmt-numbergenerator/health.svg)

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

###  Alternatives

[gg-innovative/larafirebase

Laravel Firebase Cloud Messaging.

2095.0k](/packages/gg-innovative-larafirebase)

PHPackages © 2026

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