Download the PHP package amamarul/integer-hashids without Composer
On this page you can find all versions of the php package amamarul/integer-hashids. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amamarul/integer-hashids
More information about amamarul/integer-hashids
Files in amamarul/integer-hashids
Package integer-hashids
Short Description Laravel Integers Hashids Generator. Encode and decode ids to Integers. Also generate prefixed hashids
License MIT
Informations about the package integer-hashids
Laravel Integer Hashids
Make Integers Hashids
This package is an adaptation and combination of the following 3 packages:
- Laravel-Manager https://github.com/GrahamCampbell/Laravel-Manager
- Hashids https://github.com/ivanakimov/hashids.php
- Laravel Hashids https://github.com/vinkla/laravel-hashids
This package works like Laravel Hashids but you can make integers hashids placing in alphabet connections only numbers and you can implement prefix ids. Also you can use encode() and decode() helpers. You can also make alphanumeric Hashids
Installation
Composer require
Add Provider into config/app.php
Publish config file
Usage
-
Setup the Config file (
config/hashids.php
) You can create differents connections with differents parameters- Name Connection: There are a 'main' connection that is used by default but you can create custom connections and then call them.
- salt: is a phrase string.
- length: Number of characters you need
- alphabet: you can set any character to make the hash, but if you want integer hashid keep the same ('0123456789').
-
prefix: if you want a prefixed hashid you can add the prefix, if not you can omit it or delete the parameter.
- prefix-separator: If you use a prefix maybe do you want to use a prefix separator. If not leave empty ('').
- default: you can change the default connection
-
With 'main' connection and without 'prefix' (
'prefix' => null
) -
With 'main' connection and with 'prefix' (
'prefix' => 'AA'
) -
With 'custom' name connection and with and without 'prefix'
- If you prefer to use dependency injection over facades, you can inject the manager:
- With 'main' connection
- With 'custom' connection
Helpers
You can use the 'encode()' and 'decode()' helpers
-
encode()
- decode()
Feel free to send improvements
Created by Maru Amallo-amamarul