flametrench/ids 问题修复 & 功能扩展

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

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

flametrench/ids

最新稳定版本:v0.2.0

Composer 安装命令:

composer require flametrench/ids

包简介

Prefixed wire-format IDs for Flametrench. UUIDv7 storage, self-describing public identifiers.

README 文档

README

CI

Prefixed wire-format identifiers for Flametrench.

use Flametrench\Ids\Id;

Id::generate('usr');
// → "usr_0190f2a81b3c7abc8123456789abcdef"

Id::encode('org', '0190f2a8-1b3c-7abc-8123-456789abcdef');
// → "org_0190f2a81b3c7abc8123456789abcdef"

Id::decode('usr_0190f2a81b3c7abc8123456789abcdef');
// → ['type' => 'usr', 'uuid' => '0190f2a8-1b3c-7abc-8123-456789abcdef']

Id::isValid('usr_0190f2a81b3c7abc8123456789abcdef');           // true
Id::isValid('usr_0190f2a81b3c7abc8123456789abcdef', 'org');    // false

Why prefixed IDs

Flametrench uses UUIDv7 in storage and prefixed strings on the wire. The wire format is self-describing: usr_... is a user, org_... is an organization, ses_... is a session. This is the Stripe playbook, and it pays off in every log line, support ticket, and debugger session.

The specification details live at flametrench/spec/docs/ids.md. Implementations in other languages follow the same format.

Install

composer require flametrench/ids

Requires PHP 8.3 or newer. Ships with a dependency on symfony/uid for UUID handling.

Registered type prefixes

The specification reserves the following prefixes:

Prefix Resource Spec version
usr User v0.1
org Organization v0.1
mem Membership v0.1
inv Invitation v0.1
ses Session v0.1
cred Credential v0.1
tup Authorization tuple v0.1
mfa MFA factor v0.2
shr Share token v0.2

Implementations must not invent prefixes outside the specification. New prefixes are added through the specification's RFC process.

Testing

composer install
composer test

The package uses PEST. The test suite covers encoding, decoding, validation, generation, round-trip properties, and sortability of generated IDs.

License

Apache License 2.0. Copyright 2026 NDC Digital, LLC.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固