Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Snowflake Laravel Package

kra8/laravel-snowflake

Generate distributed, time-ordered Snowflake IDs in Laravel with kra8/laravel-snowflake. It offers configurable worker and datacenter IDs, sequence handling, and an Eloquent trait, giving models unique 64-bit IDs without extra services or coordination.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Choosing ID strategy for new services and tables. kra8/laravel-snowflake provides a drop-in Eloquent trait/cast that generates 64-bit Snowflake IDs (timestamp + worker/machine ID + sequence) at insert time. This is a build-vs-buy decision you can make once and reuse: buying it off the shelf removes a week or two of engineering on clock-skew, worker-ID assignment, and sequence-rollover edge cases.
  • Scaling writes beyond a single database node. Snowflake IDs are generated client-side, so they enable multi-primary/sharded MySQL, read replicas that accept writes, and queue-worker-heavy workloads without a central auto-increment sequence — a prerequisite for horizontal write scaling.
  • Time-sortable IDs for pagination and audit. Because IDs encode creation time, they give you index-friendly, chronological keys and cheap id > ? cursor pagination without an extra created_at index or tie-breaker.
  • API and public-identifier policy. Avoids exposing sequential integers in URLs/APIs (enumeration/scraping risk) while staying compact (BIGINT, 8 bytes) instead of UUID's 16 bytes — relevant to storage-cost and index-bloat trade-offs.
  • Roadmap signal — framework currency. v2.5.0 adds Laravel 13.x compatibility, which means the package is tracking Laravel's support window. That is the gating condition for keeping it on any roadmap that assumes an upgrade to Laravel 13; without it, an upcoming framework upgrade becomes a forced migration.

Caveat for planning: Snowflake IDs leak approximate creation time and embed the worker ID, and correctness depends on disciplined worker-ID assignment across all app instances. Treat worker-ID provisioning as a first-class operational decision, not an afterthought.

When to Consider This Package

Adopt when:

  • You run (or plan) more than one application node or database writer that inserts into the same tables.
  • You need a compact, ordered primary key at high insert volume, and UUIDv4's randomness (index fragmentation, 16-byte storage) is a real cost for you.
  • You are on a Laravel version this package supports — now including Laravel 13.x as of v2.5.0 — and want a trait-level integration rather than a standalone ID library.
  • You are migrating away from AUTO_INCREMENT incrementally: the BIGINT column type means existing schema and FKs stay compatible.

Look elsewhere when:

  • You are single-node, low-volume, and auto-increment is fine — the added worker-ID configuration is pure overhead.
  • You want standards-based IDs with no embedded timestamp or machine information: prefer UUIDv7 via Laravel's built-in HasUuids/HasUniqueStringIds, or symfony/uid.
  • Your storage is Postgres-centric and you would rather use BIGSERIAL/identity columns with sequences, or you need IDs to survive database-level generation (Snowflake IDs are app-generated, so raw-SQL inserts must supply their own ID).
  • You need long-term vendor support, SLA, or a security review of the ID-generation algorithm: this is a small, single-maintainer package (~a handful of source files). Acceptable as a leaf dependency, risky as a load-bearing platform component without a fork-and-own plan.
  • You require the maintainer's own feature roadmap (custom epoch, datacenter bits, presets) — that surface has been static; you may need to fork.

Release-specific vetting before adoption: v2.5.0 is a compatibility and housekeeping release — Laravel 13 support (via an automated Laravel Shift PR), a nesbot/carbon bump to 2.72.6, and league/commonmark to 2.7.0. There are no new features, no deprecations, and no breaking changes, so upgrading from v2.4.1 is low risk. Verify two things in your own CI rather than trusting the changelog: (1) that the Laravel 13 support is validated against the version you will actually run (automated compatibility PRs can land ahead of a stable framework release), and (2) that the Carbon bump is compatible with any code pinning Carbon 3.x — Carbon 2 is past end-of-life, so if your app is on Carbon 3 this dependency constraint may hold you back.

How to Pitch It (Stakeholders)

To executives — one paragraph: We need a reliable way to generate unique record IDs as we scale beyond a single database. Rather than build one, we can adopt a small existing library that plugs directly into our Laravel models and costs nothing to license. It lets us split data across multiple databases without ID collisions, keeps our primary keys compact (8 bytes versus 16 for UUIDs, which matters at millions of rows), and keeps IDs sortable by time for faster pagination. The newest release (v2.5.0) adds support for Laravel 13, so adopting it does not create a blocker for our next framework upgrade. Decision required: approve it as a low-risk, isolated dependency, with the caveat that it is maintained by a single author, so we should plan to vendor/fork it if it ever becomes critical-path.

To engineering — the short version: kra8/laravel-snowflake v2.5.0 gives us Snowflake ID generation through an Eloquent trait/cast, and it now supports Laravel 13. It is a pure compat + dependency-bump release: no API changes, no breaking changes, safe upgrade from v2.4.1. It solves client-side ID generation on BIGINT columns so we can run multiple writers and shards without a central sequence. Costs we accept: we must own worker-ID assignment per instance (misconfiguration risks collisions), IDs embed a timestamp and worker ID, and raw-SQL inserts bypass generation. Note the Carbon 2.x pin — check it against any Carbon 3 work. Alternative we evaluated: UUIDv7 via Laravel's built-in traits, which has no worker-ID burden but costs twice the storage and needs ordered-UUID support in the database. Recommendation: adopt for new high-write, sharded tables; keep auto-increment for small, single-node tables; budget a fork-and-own contingency given the single-maintainer risk.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels