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

ActiveLibrary

colyll/date-snowflake
=====================

Add date string before a Short twitter's snowflake ID

1363PHP

Since Apr 21Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

date-snowflake
==============

[](#date-snowflake)

Add date string before a Short twitter's snowflake ID, e.g. 2021031336140492049070.

```
/**
 *  由于雪花算法加上日期有26位长，所以修改缩小到22位。
 * |-------------------------雪花算法 (64bits)-------------------------------|
 * |--补位(1bit)--|---时间戳毫秒(41bit)---|---机器ID(10bit)--|---序号(12bit)--|
 *
 *           |-----------------------修改后(48bits)---------------------------|
 *    日期 + |----每日当前毫秒(28bit)---|---机器ID(9bit)---|----序号(11bit)----|
 *
 */

```

use
===

[](#use)

a. General usage
----------------

[](#a-general-usage)

```
require('../src/DateSnowflake.php');
use Colyll\DateSnowflake;
$dateSnowflake = new DateSnowflake(10);

$id = $dateSnowflake->id();
```

b. Use it in Laravel project
----------------------------

[](#b-use-it-in-laravel-project)

```
composer require colyll/date-snowflake dev-laravel

```

copy `config/snowflake.php` into project\_root/config/ directory, use `SNOWFLAKE_MACHINE_ID=1` to set the machine ID in `.env`file.

```
use Colyll\DateSnowflake;
$dateSnowflake = new DateSnowflake();

$id = $dateSnowflake->id();
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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