Skip to content

Class for generating random strings with defined parameters

License

Notifications You must be signed in to change notification settings

didatus/RandomString

Repository files navigation

RandomString

A simple class for generating random strings.

Latest Stable Version License Build Status Scrutinizer Code Quality Code Coverage

Create RandomString Instance

use Didatus\RandomString\RandomString;
$randomString = new RandomString();

Create RandomString Instance with own character pool and with excluding characters

use Didatus\RandomString\RandomString;
$randomString = new RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1IO0');

Excluding characters can be helpful for generating readable coupons (without confusing 0 and O for example).

Generate a single random string

$randomString = new RandomString();
$string = $randomString->getString(10);

Generate a single random alpha numeric string excluding confusing characters

$randomString = new RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1IO0');
$string = $randomString->getString(10);

generate a list of five random tokens

$randomString = new RandomString();
$strings = $randomString->getListOfString(10, 5);

C8H5

About

Class for generating random strings with defined parameters

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages