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

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

mitoop/laravel-snowflake
========================

v2.3.0(3mo ago)0213MITPHPPHP ^8.2

Since Aug 17Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/mitoop/laravel-snowflake)[ Packagist](https://packagist.org/packages/mitoop/laravel-snowflake)[ RSS](/packages/mitoop-laravel-snowflake/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (6)Versions (7)Used By (0)

Laravel Snowflake
=================

[](#laravel-snowflake)

环境需求
----

[](#环境需求)

- PHP: `^8.2`
- Laravel: `^11|^12`

安装
--

[](#安装)

```
composer require mitoop/laravel-snowflake
```

发布配置文件
------

[](#发布配置文件)

```
php artisan vendor:publish --provider="Mitoop\LaravelSnowflake\ServiceProvider"
```

`snowflake.php`配置文件

```
return [
    // 纪元时间
    'epoch' => '2023-08-01 00:00:00',
    // 数据中心id 范围:[0-31]. 为 null时, 随机取[0-31]的值
    'datacenter_id' => null,
    // 工作机器id 范围:[0-31]. 为 null时, 随机取[0-31]的值
    'worker_id' => null,
    // 序列号生成策略类 为 null 时, 使用随机数. 其他请指定类名如: RedisSequenceStrategy::class
    'sequence_strategy' => null,
];
```

可用方法
----

[](#可用方法)

1. 模型类可使用 `HasSnowflakeIds` trait, 支持多字段, 具体用法同 `HasUuids`, `HasUlids` [Doc](https://laravel.com/docs/10.x/eloquent#uuid-and-ulid-keys)
2. Str 快捷方法 `\Str::snowflakeId()`
3. Blueprint方法

```
    Schema::create('tests', function (Blueprint $table){
         $table->snowflake()->primary();
         $table->snowflake('another_snowflake_id');
         $table->timestamps();
    });
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance82

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Recently: every ~239 days

Total

6

Last Release

93d ago

Major Versions

v1.0.0 → v2.0.02024-04-17

PHP version history (2 changes)1.0.x-devPHP ^8.1

v2.2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1645a978f51dcbbc8e50a17bf7daaa12fd1b01a4b19784d0010325d78c9b53f8?d=identicon)[Mitoop](/maintainers/Mitoop)

---

Top Contributors

[![mitoop](https://avatars.githubusercontent.com/u/7368344?v=4)](https://github.com/mitoop "mitoop (16 commits)")

---

Tags

laravel-snowflakesnowflake

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M376](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

244.6M137](/packages/illuminate-cookie)

PHPackages © 2026

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