semiorbit/serial 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

semiorbit/serial

最新稳定版本:1.0.3

Composer 安装命令:

composer require semiorbit/serial

包简介

Generate a Serial Number of alphanumeric 16 random chars in PHP.

README 文档

README

Semiorbit Serial Number Generator is a PHP library to create a Serial Number of alphanumeric 16 random chars. It is mostly unique, depending on microtime() and mt_rand() functions converted to BASE 36. (So, it should be 100% unique for one server host as long as server time is accurate and not backward).

Install

composer require semiorbit/serial

Documentation

SerialNumber::Generate

Generates an alphanumeric 16 chars Serial Number. Chars could be grouped in 4 seperated segments.

SerialNumber::Generate(string $separator = '') : string

Params

  • string $separator dash by default
  • returns string
use SemiorbitSerial\Serial;

echo SerialNumber::Generate();

echo SerialNumber::Generate('-');

// OUTPUT:

// CVPKRIJ48NZS4JRO
// CVPK-RIJ4-8NZS-4JRO

SerialNumber::Format

Returns a formatted Serial Number string width dashes (or selected separator)

SerialNumber::Format(string $serial, string $separator = '-'): string

Params

  • string $serial A Serial Number string to parse
  • string $separator Dash by default
  • returns string {xxxx-xxxx-xxxx-xxxx}
use SemiorbitSerial\Serial;

$serial = '4F93820EFEF290A26489E0AE803A37C0';

echo SerialNumber::Format($serial);

// OUTPUT:
// {4F93820E-FEF2-90A2-6489-E0AE803A37C0}

License

The Semiorbit Serial Number is an open-source PHP library licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-22