dansvel / random-generator
PHP random string generator, readable and not
dev-master
2020-11-15 14:34 UTC
Requires
- php: ^7.0
This package is auto-updated.
Last update: 2025-05-16 00:53:33 UTC
README
This random generator can generate string for human readable or indecipherable.
Installation
You can install the package via composer:
composer require dansvel/random-generator
Usage
use dansvel\RandomGenerator\Random;
Human readable
It will generate a word using combination of vowels and consonants
$composition = [ 3 => ['cvc'], 4 => ['cvcv', 'vccv', 'vcvc'], 5 => ['cvcvc', 'cvccv', 'vccvc', 'vcvcv'], 6 => ['cvcvcv', 'cvccvc', 'vcvcvc', 'vccvcv'] ];
Example :
echo Random::humane(3); // yuk echo Random::humane(4); // exem echo Random::humane(5); // idova echo Random::humane(6); // juplis
Inhumane, indecipherable
It will generate random characters according to the type you want.
Example :
echo Random::inhumane(16,'0'); // 5370719465476519 echo Random::inhumane(16,'a'); // kaqotdyeyfauztls echo Random::inhumane(16,'A'); // IWJLLMBWSTTLCMFM echo Random::inhumane(16,'aA'); // soMSTjnaiBHkczhx echo Random::inhumane(16,'0A'); // WQT4I4O2BWHCUAVJ echo Random::inhumane(16,'0aA'); // aa9LyynlVmfjA4Ht // you can use combination of 0 a and A in unordered
License
The MIT License (MIT). Please see License File for more information.