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

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

seffeng/laravel-snowflake
=========================

PHP laravel extension snowflake

v0.1.0(5mo ago)03MITPHPPHP &gt;=7.1.3

Since Jan 13Pushed 5mo agoCompare

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

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

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

[](#laravel-snowflake)

### 安装

[](#安装)

```
# 安装
$ composer require seffeng/laravel-snowflake
```

##### Laravel

[](#laravel)

```
# 1、生成配置文件
$ php artisan vendor:publish --tag="snowflake"

# 2、修改配置文件 /config/snowflake.php，或 .env
```

##### lumen

[](#lumen)

```
# 1、复制扩展内配置文件 /config/snowflake.php 到项目配置目录 /config

# 2、修改配置文件 /config/snowflake.php，或 .env

# 3、将以下代码段添加到 /bootstrap/app.php 文件中的 Providers 部分
$app->register(Seffeng\LaravelSnowflake\SnowflakeServiceProvider::class);

# 4、/bootstrap/app.php 添加配置加载代码
$app->configure('snowflake');
```

### 示例

[](#示例)

```
# 示例
use Seffeng\LaravelSnowflake\Facades\Snowflake;

class SiteController extends Controller
{
    public function test()
    {
        // 生成雪花ID
        var_dump(Snowflake::id());
    }
}
```

```
# Model 示例
use Illuminate\Database\Eloquent\Model;
use Seffeng\LaravelSnowflake\Traits\SnowflakePrimary;

class User extends Model {
    // $model->save() 时自动使用雪花ID
    use SnowflakePrimary;
}
```

### 备注

[](#备注)

1、测试脚本 tests/SnowflakeTest.php 仅作为示例供参考。

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance70

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity20

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30b3d8cc986a1ad37a55169b11812fea1cae31430dd8dbe1b3436dc58cc885bd?d=identicon)[seffeng](/maintainers/seffeng)

---

Top Contributors

[![seffeng](https://avatars.githubusercontent.com/u/3509779?v=4)](https://github.com/seffeng "seffeng (2 commits)")

---

Tags

phplaravelyii2snowflakeseffeng

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M195](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[illuminate/pagination

The Illuminate Pagination package.

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

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k93](/packages/nativephp-mobile)

PHPackages © 2026

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