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 Model Hashids Laravel Package

deligoez/laravel-model-hashids

Add short, unique Hashids to your Laravel Eloquent models. This package provides a trait that obfuscates numeric IDs for URLs and APIs, with automatic route resolution, configurable salt, length and alphabet, while keeping integer keys internally.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — A single-purpose Eloquent trait package that maps integer primary keys to opaque Hashids for route keys and serialization. It is a presentation-layer concern, not an architectural commitment: adoption is a trait on selected models (optionally a route-key override), with no service-provider surgery or data-model change. It fits any Laravel app that currently leaks sequential IDs into URLs, APIs, or export artifacts.

Integration feasibility — v4.1.0 is effectively a constraints-and-formatting release: illuminate/contracts widened to ^13.0, orchestra/testbench ^11.0 for Laravel 13 testing, Pint 1.29 style rules with no behavioral change. Upstream states composer update with no code changes. Integration effort is low: require the package, add the trait, publish config, set the salt.

Technical risk — Low direct risk, moderate indirect risk. Hashids are obfuscation, not authorization or unguessability; any access control must remain server-side. The salt is app-owned, so a leaked or rotated salt is an application-level incident (rotating it invalidates every previously issued URL). Laravel 13 support is CI-verified on PHP 8.3/8.4 across both prefer-lowest and prefer-stable resolutions, which is strong hygiene evidence but not a production track record on 13.

Key questions

  • What is our Laravel upgrade target and date, and is this package on the critical path?
  • Who owns the salt secret, where is it stored, and what is the rotation policy?
  • Which persisted or emitted identifiers (webhooks, exports, audit logs, partner contracts) depend on hashid strings remaining stable?
  • Do any target models use non-integer or composite keys?
  • Is the actual requirement obfuscation, or unguessable tokens (ULID/UUID)? The answer changes the package choice.

Integration Approach

Stack fit — Requires PHP 8.3/8.4; confirm base images and CI runners before committing. Supports Laravel 11, 12, and 13 concurrently, so one package version serves an entire fleet mid-upgrade.

Migration path — Greenfield adoption is trivial. Existing v4.0.x consumers get a drop-in composer update with no code changes; still pin the version and validate in a staging deploy rather than trusting the changelog alone.

Compatibility — The three-major support window is the operationally significant detail: it removes the package as a blocker during a phased Laravel 11 → 12 → 13 rollout. Mirror upstream's matrix in our own CI (--prefer-lowest and --prefer-stable) to catch constraint drift early.

Sequencing

  1. Adopt on a low-blast-radius surface (internal admin routes or a read-only endpoint).
  2. Add the trait and route-key override to a small set of models; confirm links, redirects, and cached URLs resolve.
  3. Expand to public-facing URLs and API responses; audit downstream consumers for stored hashid strings.
  4. Execute the Laravel 13 upgrade with the package already at v4.1.0 so it is a non-factor in the upgrade.

Operational Impact

Maintenance — Small surface area, vendor-maintained, cadence tied to Laravel majors. Formatting-only diffs in this release are a good signal of low churn. Expect roughly one compatibility release per Laravel major; budget a routine dependency-bump ticket each cycle.

Support — Community OSS with no SLA. Mitigate by noting the exit cost is genuinely low: the package is a thin wrapper over the Hashids algorithm, so an in-house replacement is days, not months, of work. Do not let it become load-bearing without that fallback documented.

Scaling — Pure-PHP encode/decode per invocation; no network hop, no external state, no cache dependency. Cost is negligible in normal request paths. Only worth benchmarking if applied inside serialization loops over large collections.

Failure modes

  • Missing or incorrect salt → every hashid fails to decode (404s across all affected links).
  • Salt rotation treated as a routine config change → all previously shared URLs break; treat the salt as a durable secret with a change-control gate.
  • Untrusted hashid input decoded without validation → error paths and potential enumeration probing.
  • Non-integer or composite-key models silently unsupported.
  • Early Laravel 13 adoption surfaces edge cases upstream CI may not model.

Ramp-up — Hours for a competent Laravel engineer: one trait, one config publish, optional route-key override. The real ramp-up cost is team education, not code — document explicitly that hashids are obfuscation, that authorization must still be enforced per request, and that the salt is a secret with a rotation policy.

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.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
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