PHPackages                             wavpa/snowflake - 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. wavpa/snowflake

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

wavpa/snowflake
===============

Snowflake ID Generator

0.0.1(5y ago)024MITPHP

Since Aug 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/wavpa/snowflake)[ Packagist](https://packagist.org/packages/wavpa/snowflake)[ RSS](/packages/wavpa-snowflake/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Snowflake
=========

[](#snowflake)

雪花算法生成全局唯一ID

安装
--

[](#安装)

```
composer require wavpa/snowflake -vvv
```

使用
--

[](#使用)

```
use Wavpa\Snowflake\Snowflake;

$snowflake = new Snowflake();

$id = $snowflake->nextId();
// 412471893908520960
```

在 Laravel 中使用
-------------

[](#在-laravel-中使用)

可以用两种方式来获取`Wavpa\Snowflake\Snowflake`实例：

1. 方法参数注入

```
public function nextId(Request $request, Snowflake $snowflake)
{
    return $snowflake->nextId();
}
```

2. 服务名访问

```
public function nextId(Request $request)
{
    return app('snowflake')->nextId();
}
```

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

2085d ago

### Community

Maintainers

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

---

Top Contributors

[![luyoyo63](https://avatars.githubusercontent.com/u/62836348?v=4)](https://github.com/luyoyo63 "luyoyo63 (1 commits)")[![wavpa](https://avatars.githubusercontent.com/u/70138271?v=4)](https://github.com/wavpa "wavpa (1 commits)")

### Embed Badge

![Health badge](/badges/wavpa-snowflake/health.svg)

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

PHPackages © 2026

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