jamosaur / randstring
随机字符串生成器
1.2.7
2016-06-29 20:23 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- phpunit/phpunit: 5.*
- scrutinizer/ocular: ~1.1
README
随机字符串生成器由颜色、动物和数字组成。
所有代码均符合PSR-2规范
安装
通过Composer
$ composer require jamosaur/randstring
用法
// 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
变更日志
有关最近更改的更多信息,请参阅变更日志。
鸣谢
许可协议
MIT许可协议(MIT)。有关更多信息,请参阅许可文件。