jamosaur/randstring

Random string generator

1.2.7 2016-06-29 20:23 UTC

This package is auto-updated.

Last update: 2024-04-09 20:50:47 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Random string generator make from colours, animals and numbers.

All code is PSR-2 friendly

Install

Via Composer

$ composer require jamosaur/randstring

Usage

// Generate a random string.

$rand = new Jamosaur\Randstring\Randstring();
echo $rand->generate();
// buoyantwhitetippedreefshark56


// Generate a sentence case string that is no greater than 15 characters long.

$rand = new Jamosaur\Randstring\Randstring('sentence', 15);
echo $rand->generate();
// BumpySquirrel32


// Generate a string with the first letter in uppercase that is no greater than 20 characters long.

$rand = new Jamosaur\Randstring\Randstring('ucfirst', 20);
echo $rand->generate();
// Moistmountaincat75


// Generate a string with the first letter in uppercase that is no longer than 35 characters long with a random 
// number between 123 and 143.

$rand = new Jamosaur\Randstring\Randstring('ucfirst', 35, 123, 143);
echo $rand->generate();
// Tangibleindianrockpython127

// Generate a string formatted in camelCase

$rand = new Jamosaur\Randstring\Randstring('camel');
echo $rand->generate();
// carefulZebra23

Change log

Please see CHANGELOG for more information what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.