maikay / maihash
simple tool to generate a random hash
This package's canonical repository appears to be gone and the package has been frozen as a result.
1.0.0
2014-07-03 18:10 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2020-07-06 06:24:21 UTC
README
simple tool to generate a random hash
Installation
To install MaiHash
put the following snippet to your composer.json
:
{ "require": { "maikay/maihash": "1.0.0" } }
Options
option | description | default |
---|---|---|
min | min length of generated hash | 5 |
max | max length of generated hash | 10 |
char | haystack of all used chars | abcdefghijklmnopqrstuvwxyz[*] |
[*] abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
Examples
Just have a look at the examples
$generator = new \MaiHash\Generator();
Example #1 - invokable
$invokeOutput = $generator( array( 'min' => 5, 'max' => 10, 'chars' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', ) ); var_dump($invokeOutput); /* output */ string '75SORZ2L6I' (length=10)
Example #2 - method call
$methodOutput = $generator->getHash( array( 'min' => 10, 'max' => 15, 'chars' => 'abcdefghijklmnopqrstuvwxyz1234567890', ) ); var_dump($methodOutput); /* output */ string '8o8p6wz3hu325h1' (length=15)