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.
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
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
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
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.
How can I help you explore Laravel packages today?