定制 robinvdvleuten/ulid 二次开发

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

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

robinvdvleuten/ulid

最新稳定版本:v5.0.0

Composer 安装命令:

composer require robinvdvleuten/ulid

包简介

Universally Unique Lexicographically Sortable Identifier (ULID) implementation for PHP.

README 文档

README

Latest Stable Version Build Status

A PHP port of ulid/javascript with some minor improvements.

Sponsored by The Webstronauts

Installation

You can install the package via Composer.

composer require robinvdvleuten/ulid

Usage

use Ulid\Ulid;

$ulid = Ulid::generate();
echo (string) $ulid; // 01B8KYR6G8BC61CE8R6K2T16HY

// Or if you prefer a lowercased output
$ulid = Ulid::generate(true);
echo (string) $ulid; // 01b8kyr6g8bc61ce8r6k2t16hy

// If you need the timestamp from an ULID instance
$ulid = Ulid::generate();
echo $ulid->toTimestamp(); // 1561622862

// You can also generate a ULID for a specific UNIX-time in milliseconds
$ulid = Ulid::fromTimestamp(1593048767015);
// or with a lower cased output: $ulid = Ulid::fromTimestamp(1593048767015, true);
echo (string) $ulid; // 01EBMHP6H7TT1Q4B7CA018K5MQ

Testing

composer test

Changelog

Please see the GitHub "Releases" page for more information on what has changed recently.

Credits

As it's just a simple port of JavaScript to PHP code. All credits should go to the original ULID specs.

License

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

统计信息

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

GitHub 信息

  • Stars: 457
  • Watchers: 6
  • Forks: 30
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04