Weave Code
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 Hashids Laravel Package

cirlmcesc/laravel-hashids

Laravel package to obfuscate model IDs and route parameters using Hashids. Adds a model trait that automatically encodes ID and *_id fields on serialization, decodes for route model binding, and provides helper methods plus Artisan install/test commands.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • User Experience (UX) Enhancements: Improve readability and memorability of URLs/IDs (e.g., abc123 instead of 1234567890) for marketing, support, or public-facing features.
  • Security & Privacy: Mask sequential database IDs (e.g., auto-incremented id fields) to prevent enumeration attacks or expose internal data structures.
  • Roadmap Alignment: Enable "short-link" or "shareable" features (e.g., referral programs, affiliate links, or branded redirects) without custom development.
  • Build vs. Buy: Avoid reinventing Hashids logic (e.g., manual implementation or third-party services) by leveraging a lightweight, Laravel-native solution.
  • Use Cases:
    • Public-facing URLs (e.g., /p/abc123 instead of /p/12345).
    • Internal tools where human-readable IDs reduce errors (e.g., support tickets, invoices).
    • Compliance requirements (e.g., masking PII in URLs).

When to Consider This Package

  • Adopt if:
    • Your Laravel app needs short, non-sequential IDs for Eloquent models with minimal overhead.
    • You prioritize simplicity over advanced features (e.g., no need for custom salting or algorithm tweaks).
    • Your team lacks bandwidth to build/maintain a custom Hashids integration.
    • You’re using Laravel 5.5+ (package compatibility) and need seamless Eloquent integration.
  • Look elsewhere if:
    • You need high customization (e.g., dynamic alphabet sets, salt per model).
    • Your IDs require bidirectional conversion (number ↔ hash) frequently (this package focuses on hashing only).
    • You’re using non-Laravel frameworks or need a standalone PHP solution.
    • Your use case demands performance at scale (e.g., billions of IDs; this package isn’t battle-tested for that).
    • You need built-in collision handling or statistical guarantees (this relies on Hashids’ defaults).

How to Pitch It (Stakeholders)

For Executives: "This package lets us generate short, memorable IDs (like YouTube’s video links) for our [feature X] without extra engineering effort. It’s a lightweight, secure way to improve UX and hide internal database sequences—reducing support tickets and potential security risks. MIT-licensed and Laravel-native, so it integrates smoothly with our stack. Estimated dev time: 1–2 hours vs. weeks for a custom build."

For Engineering: *"The laravel-hashids package wraps the Hashids library to auto-generate short, non-sequential IDs for Eloquent models. Key benefits:

  • Zero config: Works out-of-the-box with Laravel’s Eloquent.
  • Security: Masks auto-increment IDs by default (configurable salt).
  • Performance: Minimal overhead; uses PHP’s Hashids under the hood.
  • Extensible: Can customize alphabet/salt per model if needed. Tradeoff: No built-in reverse-lookup (number → hash), but we can add that later if required. Recommended for [use case Y] where readability/obfuscation matters more than uniqueness guarantees."*
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.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony