Download the PHP package dialloibrahima/eloquent-hashids without Composer
On this page you can find all versions of the php package dialloibrahima/eloquent-hashids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dialloibrahima/eloquent-hashids
More information about dialloibrahima/eloquent-hashids
Files in dialloibrahima/eloquent-hashids
Package eloquent-hashids
Short Description Hashids obfuscation for Laravel models
License MIT
Homepage https://github.com/ibra379/eloquent-hashids
Informations about the package eloquent-hashids
Eloquent Hashids
A Laravel package that automatically obfuscates Eloquent model IDs in URLs by converting them to reversible hash strings. This improves security and aesthetics by hiding sequential database IDs.
Features
- ✅ Zero dependencies - Uses a custom Base62 encoder
- ✅ Automatic route model binding - Works seamlessly with Laravel routes
- ✅ Reversible hashes - Decode hashids back to original IDs
- ✅ Per-model configuration - Customize prefix, suffix, length per model
- ✅ Laravel 10, 11, 12 support
Installation
Publish the config file:
Usage
Basic Usage
Add the Hashidable trait to your model:
Now you can use hashids in your URLs:
Per-Model Configuration
Implement HashidableConfigInterface to customize hashids per model:
API Resources
Expose hashids in your API responses:
Configuration
Custom Route Binding
If your model already has a custom resolveRouteBinding(), use the helper method:
⚠️ Warning: Changing the
saltwill invalidate all existing hashids!
Testing
Security
Hashids provide obfuscation, not encryption. They:
- ✅ Hide sequential IDs
- ✅ Prevent URL enumeration
- ❌ Are NOT cryptographically secure
- ❌ Do NOT replace authentication/authorization
Always use proper authorization in your controllers:
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of eloquent-hashids with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0
illuminate/database Version ^10.0||^11.0||^12.0
illuminate/support Version ^10.0||^11.0||^12.0