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

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

yiranzai/snowflake
==================

This package to generate 64 bit identifier, use snowflakes from Twitter.

v0.1.1(7y ago)510711MITPHPPHP ~7.1

Since Mar 23Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (3)Used By (1)

snowflake
=========

[](#snowflake)

[ENGLISH](README.md) | [中文](docs/README_ZH_CN.md)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cb88dda7d94b6a34c15a07f4ab53a578bb15e413aca1ecb64f23776bb84e8a09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796972616e7a61692f736e6f77666c616b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yiranzai/snowflake)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](docs/LICENSE.md)[![Build Status](https://camo.githubusercontent.com/6262bba4306d0b5ef45e5815c24a5923c4e2abfa8131b524597483c635a516b6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f796972616e7a61692f7068702d736e6f77666c616b652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/yiranzai/php-snowflake)[![Coverage Status](https://camo.githubusercontent.com/45901ae6de542b66a7bd9ae614987c926ecccd7f1f655212ce7e08ebb4392c81/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f796972616e7a61692f7068702d736e6f77666c616b652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yiranzai/php-snowflake/code-structure)[![Quality Score](https://camo.githubusercontent.com/73e7499815f9068debb51adb10fc3f1b0aa37db1d0deeffd260f3407768284a3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f796972616e7a61692f7068702d736e6f77666c616b652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yiranzai/php-snowflake)[![Total Downloads](https://camo.githubusercontent.com/021e104af4fb7000e2aa035c7cdd69ccafce519e4c1c92d0c837aeedd301296f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796972616e7a61692f736e6f77666c616b652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yiranzai/snowflake)

[![](https://camo.githubusercontent.com/cbece7a1dedddf9424810cc814b5643090e9e6047efbf4cc157e78b722e4bed2/68747470733a2f2f63646e2e796972616e7a61692e636e2f696d616765735f75706c6f61642f32303139303332333137353235382e706e67)](https://camo.githubusercontent.com/cbece7a1dedddf9424810cc814b5643090e9e6047efbf4cc157e78b722e4bed2/68747470733a2f2f63646e2e796972616e7a61692e636e2f696d616765735f75706c6f61642f32303139303332333137353235382e706e67)

This package to generate 64 bit identifier, use snowflakes from Twitter.

Structure
---------

[](#structure)

```
src/
tests/

```

Install
-------

[](#install)

Via Composer

```
$ composer require yiranzai/snowflake
```

Usage
-----

[](#usage)

```
$id = \Yiranzai\SnowFlake\SnowFlake::next($dataCenterId = 1, $workerId = 2);
$node = \Yiranzai\SnowFlake\SnowFlake::analysis($id);

echo $node->dataCenterID; // 1
echo $node->workerID; // 2
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](docs/CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](docs/CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](docs/CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [yiranzai](https://github.com/yiranzai)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

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

Total

2

Last Release

2590d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/131c451d3fbf74a922387ce2b4c1e0e2e282afcabe8f67a09fc9fa25bbb09799?d=identicon)[yiranzai](/maintainers/yiranzai)

---

Top Contributors

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

---

Tags

snowflakeyiranzai

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

188402.3k6](/packages/kra8-laravel-snowflake)[hyperf/snowflake

A snowflake library

25808.0k59](/packages/hyperf-snowflake)[identifier/identifier

Common Interfaces and Factories for Identifiers

3226.2k1](/packages/identifier-identifier)[wantp/snowflake

A package for create unique id by snowflake

399.5k1](/packages/wantp-snowflake)[ramsey/identifier

A PHP library for generating and working with identifiers, including UUIDs, ULIDs, and Snowflakes

603.0k1](/packages/ramsey-identifier)[hafael/laraflake

Laravel Package based on Twitter Snowflake ID Generator (64 bit ID).

287.9k1](/packages/hafael-laraflake)

PHPackages © 2026

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