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 Uuid Laravel Package

nevadskiy/laravel-uuid

A Laravel package that adds UUID support to Eloquent models, making it easy to use universally unique identifiers as primary keys. It provides traits and helpers for generating and assigning UUIDs automatically, simplifying setup and integration with existing models.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is intentionally minimal: a single Eloquent trait that swaps the auto-incrementing integer primary key for a UUID. That aligns cleanly with Laravel’s trait-composition conventions for models and requires no service provider, facade, or config layer in the typical case. The architectural concern is strategic rather than structural: Laravel 9+ ships HasUuids and HasUniqueStringIds in the framework itself, and both cover the same ground. For any application on a supported Laravel version, this package is functionally redundant. Its remaining value is limited to legacy Laravel 8-and-earlier codebases or teams that prefer an external, explicitly pinned dependency over framework behavior.

Integration feasibility. Low effort for greenfield work. The expected path is: composer require nevadskiy/laravel-uuid, add the trait to the model, ensure $keyType = 'string' and $incrementing = false are handled (either by the trait or manually), and declare the migration column as uuid/char(36). The real work is downstream: every foreign key referencing the table must change type, route model binding must be verified, factories and seeders must stop assuming integers, and API contracts change shape (string vs int IDs). That work is migration effort, not package effort.

Technical risk. Adoption signals are the dominant risk here: zero stars, zero dependents, and a composite opportunity score in the low teens indicate the package has not been exercised in the wild. Specific risks:

  • Maintenance/abandonment — single-maintainer, low-visibility project with no evidence of release cadence.
  • Framework drift — likely pins to older illuminate/support constraints; may break on Laravel 10/11/12 or PHP 8.2+.
  • UUID version semantics — most trait implementations use UUID v4 (random). Random PKs cause B-tree index fragmentation and write amplification on InnoDB at scale. No evidence it supports v7/ordered UUIDs or binary(16) storage.
  • Storage overhead — char(36) primary keys are ~4.5x the size of bigint, compounded across every secondary index and foreign key.
  • Unverified quality gates — no visibility into test coverage, CI, or static analysis; a subtle bug in key generation surfaces as duplicate-key errors or silent collisions.
  • Supply chain — a tiny, unaudited dependency in the model layer is meaningful attack surface relative to its benefit.

Key questions.

  1. Which UUID version is generated (v4, v6, v7), and is ordered-UUID generation configurable?
  2. Does it override getKeyType(), getIncrementing(), and getKeyName(), or does it require manual model configuration?
  3. What are the PHP and illuminate/* version constraints, and is Laravel 11/12 supported?
  4. Does it implement UniqueIds / is it compatible with the native HasUuids interface?
  5. Does it support binary(16) storage and Postgres native uuid columns?
  6. Is there CI, test coverage, and a documented release history?
  7. What is the license, and is the maintainer responsive to issues?
  8. Does it address route model binding, JSON serialization, and mass assignment out of the box?

Integration Approach

Stack fit. Appropriate for Laravel 8-and-earlier applications using Eloquent on MySQL, Postgres, or SQLite where integer PKs are being replaced for external-facing identifiers. For Laravel 9+, the correct recommendation is to use the framework’s native traits and treat this package as a reference implementation, not a dependency.

Migration path. Two distinct scenarios:

  • Greenfield: adopt the pattern before any data exists. Add the trait, set the migration column type, and standardize on a UUID type across all new tables so foreign keys stay consistent.
  • Brownfield: this is a schema migration, not a package install. Sequence: (1) add a nullable uuid column alongside the existing integer PK, (2) backfill in batches, (3) add a unique index, (4) update foreign keys and application code to reference the UUID, (5) switch the model’s key, (6) drop the integer PK only after a soak period. Do not attempt an in-place PK type change on a live table.

Compatibility. Verify the composer constraints against the target Laravel and PHP versions before committing. Pin the exact version, and confirm behavior on the specific database driver — MySQL has no native UUID type (Laravel maps uuid() to char(36)), Postgres does, and SQLite treats it as text. Cross-driver consistency should be tested explicitly if the team supports more than one.

Sequencing.

  1. Spike on a non-critical, low-write model.
  2. Validate migrations, factories, seeders, route model binding, and API serialization.
  3. Establish a house convention (UUID version, storage format, column type) — ideally documented, since the package may not enforce it.
  4. Roll out table-by-table with foreign keys updated in dependency order.
  5. Reassess at the first Laravel major upgrade whether to migrate to native HasUuids.

Operational Impact

Maintenance. The package itself is trivial code — a fork or in-house replacement is a few dozen lines, which caps the maintenance downside. The real cost is ownership of the convention: someone must decide UUID version, storage format, and migration patterns, and document them. Treat the dependency as replaceable by design and keep an internal fallback trait ready.

Support. Expect no meaningful community support: no dependents, no issue ecosystem, no Stack Overflow corpus. Documentation is likely the README only. Onboarding knowledge must be internalized and written down rather than sourced from the vendor.

Scaling. This is the most consequential operational factor. Random UUIDs as clustered primary keys degrade write throughput on InnoDB as tables grow — page splits, larger indexes, more IO per insert. Secondary indexes and foreign keys each carry the 36-byte payload. For high-write tables, prefer ordered UUIDs (v7) or binary(16) storage; if the package only emits v4, that constraint should be documented and, where it matters, overridden at the application layer.

Failure modes.

  • Duplicate-key errors from flawed or misconfigured generation, surfacing under load.
  • Foreign key type mismatch causing migration failures or silent truncation.
  • Route model binding returning 404s because the model still advertises an integer key type.
  • Mass assignment or find() calls assuming integers.
  • Dependency breakage on a Laravel/PHP upgrade with no upstream fix forthcoming.
  • API consumers breaking on the int-to-string ID type change — a client-facing contract change, not just an internal one.

Ramp-up. Minimal for any Laravel developer — the trait pattern is familiar and the surface area is small. The ramp-up cost sits with migration planning, database performance review, and API contract coordination, not with learning the package. Budget accordingly: the package is a one-hour decision; the schema and contract changes are the project.

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.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log