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

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

septech-laravel/snowflake
=========================

Snowflake for laravel

v1.0.3(5y ago)393MITPHP

Since Aug 22Pushed 5y ago2 watchersCompare

[ Source](https://github.com/SepteniTechnology/laravel-snowflake)[ Packagist](https://packagist.org/packages/septech-laravel/snowflake)[ RSS](/packages/septech-laravel-snowflake/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

README
======

[](#readme)

Installation
------------

[](#installation)

```
composer require septech-laravel/snowflake

# Public config
php artisan vendor:publish --provider="Septech\\Snowflake\\SnowflakeServiceProvider"
```

Environment
-----------

[](#environment)

```

#
SNOWFLAKE_EPOCH="2019-07-01 00:00:00"

```

Usages
------

[](#usages)

```
use Septech\Snowflake\Facades\Snowflake;

Snowflake::next(); // Alias for id()
Snowflake::id();
Snowflake::parseId('6696174721395998720');
```

Zookeeper
---------

[](#zookeeper)

To use the Zookeeper we need a DB connection to keep tracking assigned IDs &amp; machine owned that ID.

### Migration database

[](#migration-database)

```
# Migrate database schema
php artisan migrate

# Assign the worker id to .env for current marchine.
# It will take the hostname from AWS or get the hostname by gethostname()
php artisan worker:allocate
```

### API

[](#api)

#### Register routes

[](#register-routes)

```
// -- routes/api.php
use Septech\Snowflake\Facades\Snowflake;

Snowflake::routes();
```

#### Wrap routes within group

[](#wrap-routes-within-group)

```
use Septech\Snowflake\Facades\Snowflake;

Route::group(['prefix' => '/snowflake'], function () {
    Snowflake::routes();
});
```

#### Apply the built-in middleware

[](#apply-the-built-in-middleware)

We provides a simple middleware to protect the API. The middleware will take token from the `Authorization` header. Or from $\_GET\['token'\] or $\_POST\['token'\]. Then compare with a secret key set by config `snowflake.sever_to_server_token` or `env('SNOWFLAKE_HTTP_TOKEN')`. You can set the key manually or run command

```
php artisan worker:token

```

**Force it to override**

```
php artisan worker:token --force

```

```
Route::group(['middleware' => \Septech\Snowflake\Http\Middleware\ServerToken::class], function () {
    Snowflake::routes();
});
```

#### Using Kernel routeMiddleware

[](#using-kernel-routemiddleware)

```
// app/Http/Kernel.php
protected $routeMiddleware = [
    // ...
    'server_token' => \Septech\Snowflake\Http\Middleware\ServerToken::class
    // ...
];

// routes/api.php
Route::group(['middleware' => 'server_token'], function () {
    Snowflake::routes();
});
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~26 days

Total

4

Last Release

2006d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/02dfb06930faaa60adb9b1311b848ab5d4dff7c201f1a52ddafeb1f99c223360?d=identicon)[dotuancd](/maintainers/dotuancd)

---

Top Contributors

[![tuan-da](https://avatars.githubusercontent.com/u/83628571?v=4)](https://github.com/tuan-da "tuan-da (6 commits)")[![dotuancd](https://avatars.githubusercontent.com/u/5421202?v=4)](https://github.com/dotuancd "dotuancd (1 commits)")

---

Tags

laravel-snowflakesnowflakelaravelsnowflake

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[kra8/laravel-snowflake

Snowflake for Laravel and Lumen.

188402.3k6](/packages/kra8-laravel-snowflake)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[hafael/laraflake

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

287.9k1](/packages/hafael-laraflake)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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