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

Maintainers

Package info

github.com/flametrench/ids-php

Homepage

Issues

pkg:composer/flametrench/ids

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-04-24 14:02 UTC

This package is auto-updated.

Last update: 2026-04-25 01:32:06 UTC


README

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 v0.1 specification reserves the following prefixes:

Prefix Resource
usr User
org Organization
mem Membership
inv Invitation
ses Session
cred Credential
tup Authorization tuple

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.