Hashids bundle for Lavalite
This package is auto-updated.
Last update: 2022-11-29 02:18:07 UTC
This package uses the classes created by hashids.org
Generate hashes from numbers, like YouTube or Bitly. Use hashids when you do not want to expose your database ids to the user.
To get the latest version of Hashids simply require it in your
You'll then need to run
composer install to download it and have the autoloader updated.
Once Hashids is installed you need to register the service provider with the application. Open up
config/app.php and find the
There is no need to add the Facade, the package will add it for you.
Run this on the command line from the root of your project:
$ php artisan vendor:publish
A configuration file will be publish to
Add verison 1.0 of Hashids in your
And following the directions in the README on version 1.0.
Once you've followed all the steps and completed the installation you can use Hashids.
You can simply encode a single id:
Hashids::encode(1); // Returns Ri7Bi
Hashids::encode(1, 21, 12, 12, 666); // Returns MMtaUpSGhdA
Hashids::decode(Ri7Bi); // Returns array (size=1) 0 => int 1
Hashids::decode(MMtaUpSGhdA); // Returns array (size=5) 0 => int 1 1 => int 21 2 => int 12 3 => int 12 4 => int 666
- Upgraded to Laravel 5
- Upgraded to Hashids 1.0.5
Several public functions are renamed to be more appropriate:
Hashids was designed to encode integers, primary ids at most. Hashids is the wrong algorithm to encrypt sensitive data. So to encourage more appropriate use,
encrypt/decryptis being "downgraded" to
Version tag added:
All credit for Hashids goes to Ivan Akimov (@ivanakimov), thanks to for making it!