PHPackages                             progamesigner/snowflakes - 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. progamesigner/snowflakes

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

progamesigner/snowflakes
========================

A decentralized, k-ordered UUID generator in PHP

v0.1.1(8y ago)34051MITPHPPHP &gt;=5.6.3

Since Jun 7Pushed 8y agoCompare

[ Source](https://github.com/progamesigner/snowflakes-php)[ Packagist](https://packagist.org/packages/progamesigner/snowflakes)[ RSS](/packages/progamesigner-snowflakes/feed)WikiDiscussions master Synced 2d ago

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

Snowflakes
==========

[](#snowflakes)

Snowflakes is a [PHP](https://php.net/) and [Composer](https://getcomposer.org/) package that provides:

- A simple 128-bit id generator.
- Methods to convert snowflakes ID into string

Snowflakes produces 128-bit and time-ordered ids. They run one on each node in infrastructure and will generate conflict-free ids on-demand without coordination.

The project is inspired by [Twitter's Snowflake](https://github.com/twitter/snowflake) and [Go implementation of Discord](https://github.com/bwmarrin/snowflake) but extended to 128-bit and not compatible with Twitter's Snowflake. This library provides a basis for id generation but not a service for handing out ids nor node id coordination.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require progamesigner/snowflakes
```

### Usage

[](#usage)

```
use ProGameSigner\Snowflakes\Node;

$node = new Node($worker_id);

$some_id = $node->next()->toString();
```

If you are using [Laravel](https://laravel.com/), you can use `SnowflakesServiceProvider` shipped with this package. Configure `worker id` with `config('services.snowflakes.id', $worker_id)` and get snowflake with `resolve('snowflakes')->next()`.

### Format

[](#format)

Snowflakes ids are 128-bits wide described here from most significant to least significant bits:

- timestamp (64-bit) - milliseconds since the epoch (Jan 1 1970)
- node id(48-bit) - a configurable node id
- sequence (16-bit) - usually 0, increasing when more than one request in the same millisecond and reset to 0 when clock ticks forward

#### System Clock Dependency

[](#system-clock-dependency)

You should use NTP to keep your system clock accurate. Snowflakes holds requests when non-monotonic clock detected. To run in a mode where NTP not move the clock backwards, see [http://wiki.dovecot.org/TimeMovedBackwards#Time\_synchronization](http://wiki.dovecot.org/TimeMovedBackwards#Time_synchronization) for tips on how to do this.

Related Projects
----------------

[](#related-projects)

- [progamesigner/snowflakes-gem](https://github.com/progamesigner/snowflakes-gem)

Maintainers
-----------

[](#maintainers)

[@progamesigner](https://github.com/progamesigner).

Contribute
----------

[](#contribute)

1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull request** so that I can review your changes

License
-------

[](#license)

[MIT](LICENSE) © Yang Sheng Han

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

2942d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6a195611b6b92a598dd36467203a128d0a8837807c80c1844502bf6a3022430?d=identicon)[Yang Sheng Han](/maintainers/Yang%20Sheng%20Han)

---

Top Contributors

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

---

Tags

ntpphpsnowflakeuuidsnowflakesnowflakes

### Embed Badge

![Health badge](/badges/progamesigner-snowflakes/health.svg)

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

###  Alternatives

[ramsey/uuid

A PHP library for generating and working with universally unique identifiers (UUIDs).

12.6k700.2M3.3k](/packages/ramsey-uuid)[symfony/polyfill-uuid

Symfony polyfill for uuid functions

688335.4M63](/packages/symfony-polyfill-uuid)[symfony/uid

Provides an object-oriented API to generate and represent UIDs

610280.0M754](/packages/symfony-uid)[webpatser/laravel-uuid

Laravel integration for webpatser/uuid - High-performance drop-in UUID replacements (15% faster than Ramsey). Provides Str macros, HasUuids trait, facades, and casts. RFC 4122/9562 compliant.

1.8k17.3M129](/packages/webpatser-laravel-uuid)[pascaldevink/shortuuid

PHP 7.4+ library that generates concise, unambiguous, URL-safe UUIDs

5951.8M15](/packages/pascaldevink-shortuuid)[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

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

PHPackages © 2026

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