https://github.com/dansvel/random-generator
PHP random string generator, readable and not
https://github.com/dansvel/random-generator
composer-package php php-package
Last synced: 11 months ago
JSON representation
PHP random string generator, readable and not
- Host: GitHub
- URL: https://github.com/dansvel/random-generator
- Owner: dansvel
- License: mit
- Created: 2020-06-11T16:52:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-15T14:35:11.000Z (about 5 years ago)
- Last Synced: 2025-02-06T01:33:18.032Z (about 1 year ago)
- Topics: composer-package, php, php-package
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP random string generator, readable and not
This random generator can generate string for human readable or indecipherable.
## Installation
You can install the package via composer:
```bash
composer require dansvel/random-generator
```
## Usage
``` php
use dansvel\RandomGenerator\Random;
```
### Human readable
It will generate a word using combination of vowels and consonants
```php
$composition = [
3 => ['cvc'],
4 => ['cvcv', 'vccv', 'vcvc'],
5 => ['cvcvc', 'cvccv', 'vccvc', 'vcvcv'],
6 => ['cvcvcv', 'cvccvc', 'vcvcvc', 'vccvcv']
];
```
Example :
```php
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 :
```php
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](LICENSE) for more information.