定制 thoom/generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thoom/generator

Composer 安装命令:

composer require thoom/generator

包简介

PHP 5.3 classes used to generate strings such as UUID and alphanumeric

README 文档

README

These classes are static classes that generate various values that you may need in the an application. I frequently use the RandomString methods to build temporary passwords, and the Uuid class to create unique ids to entities that are put/posted to a collections url.

Usage

To create a Uuid:

$uuid = Thoom\Generator\Uuid::v4();
//outputs something like: ef8dbbaf-681a-4329-b58c-262a6c2c1fb4

To create a random alphanumeric string, lowercase only, 16 characters:

use Thoom\Generator\RandomString;

// .... code ... //

$string = RandomString::alnum(16, RandomString::ALPHANUM_LOWER);
//outputs something like: asb0z93dg91st73l

To add custom characters (like a dash) to a random string:

use Thoom\Generator\RandomString;

// .... code ... //

$string = RandomString::user(16, array('-'), RandomString::ALPHANUM_LOWER);
//outputs something like: p2am-53s9xrzb63n

统计信息

  • 总下载量: 50
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-22