Uuid7EventIdGenerator
Rasuvaeff\Yii3AbTesting\Uuid7EventIdGenerator
Class · rasuvaeff/yii3-ab-testing · Source · implements EventIdGenerator
Default generator: UUIDv7 as specified by RFC 9562, with no dependency beyond the core so composer require alone yields a working package.
Layout: 48-bit big-endian Unix timestamp in milliseconds, 4-bit version 0111, 12 bits of randomness, 2-bit variant 10, 62 bits of randomness. The leading timestamp makes identifiers sort by creation time, which is why this format is the default — it doubles as a useful sort prefix in analytics storage.
Ordering holds between milliseconds. Two identifiers minted within the same millisecond have no defined order: RFC 9562's monotonic counter would require per-process state that gives no guarantee across PHP-FPM workers anyway, so it is deliberately not implemented. Nothing in the pipeline depends on intra-millisecond ordering.
To use a library implementation instead, inject SymfonyUidEventIdGenerator or RamseyUuidEventIdGenerator.
Constructor
new Uuid7EventIdGenerator(Psr\Clock\ClockInterface $clock = new SystemClock())Methods
generate()
generate(): string