royalcms / hashids
Royalcms package for Hashids
v5.0.0
2019-09-04 05:17 UTC
Requires
- php: >=5.4.0
- hashids/hashids: 1.0.6
This package is auto-updated.
Last update: 2025-03-05 18:33:45 UTC
README
A hashids wrapper for Royalcms Component.
Installation
Facade
To add facade support for Royalcms, add the following line inside your config/facade.php
under the alias section...
'RC_Hashids' => 'Royalcms\Component\Hashids\Facades\Hashids',
then add the following to your .env
file:
# HASHIDS HASHIDS_SALT = YOURSECRETKEY HASHIDS_LENGTH = 8 HASHIDS_ALPHABET = abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPAQRSTUVWXYZ1234567890
Settings
name | description | default |
---|---|---|
salt | The secret used for hashing. | MYREALLYSECRETSALT |
length | The maximum length of the hash. | 10 |
alphabet | The characters used for hashing. | abcedefghijklmnopqrstuvwxyzABCEDEFGHIJKLMNOPQRSTUVWXYZ123456890 |
Usage
Encode
Encode a series of integers
royalcms('hashids')->encode(...$integers);
or with the facade
RC_Hashids::encode(...$integers);
Decode
Decode a encoded string back to the original integers
royalcms('hashids')->decode($encoded);
or with the facade
RC_Hashids::decode($encoded);
License
This library is licensed under MIT, see license.md for details.