didatus / random-string
Class for generating random strings with defined parameters
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/didatus/random-string
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: 5.2.*
This package is auto-updated.
Last update: 2025-10-10 06:00:57 UTC
README
A simple class for generating random strings.
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