Download the PHP package tobymaxham/laravel-hashid without Composer
On this page you can find all versions of the php package tobymaxham/laravel-hashid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tobymaxham/laravel-hashid
More information about tobymaxham/laravel-hashid
Files in tobymaxham/laravel-hashid
Package laravel-hashid
Short Description Hashed IDs for Laravel: hide your database IDs in URLs, route model binding, queries, validation and JSON.
License MIT
Homepage https://github.com/TobyMaxham/laravel-hashid
Informations about the package laravel-hashid
This Laravel package ensures that IDs are not directly visible in URLs or other public areas.
Instead, they are encoded and, for example, products/34 is converted to products/h:J7dVgYxKPwyQejOMnL.
Installation
You can install the package via composer:
This package relies on
hashids/hashids, which requires either the GMP or BCMath extension. GMP is recommended for best performance and should be installed if possible.
Configuration
Publish the configuration file with:
For example, the configuration file config/hashids.php looks like this:
Usage
Using the Facade
Using Dependency Injection
If you prefer to use dependency injection:
Automatically Decode Hash IDs
You can use the trait HashId in your models to automatically decode hash IDs:
Now you can use them in routes:
Security
- Make sure your salt value remains secret and is not published in your repository.
- The encoded IDs are not encrypted, just encoded. Therefore, they are not secure and should not be used for security purposes.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
If you've found a bug regarding security please mail mailto:[email protected] instead of using the issue tracker.
Support me
Credits
- TobyMaxham
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-hashid with dependencies
hashids/hashids Version ^5.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0