Skip to content

feat(uuid): add Base32 parsing API#17

Merged
michalsn merged 1 commit into
michalsn:developfrom
memleakd:feat/from-base32
May 16, 2026
Merged

feat(uuid): add Base32 parsing API#17
michalsn merged 1 commit into
michalsn:developfrom
memleakd:feat/from-base32

Conversation

@memleakd
Copy link
Copy Markdown
Contributor

Description
Added Uuid::fromBase32() as the matching parser for UUID values emitted with UuidWrapper::toBase32().

The package already supports converting UUIDs to Base32, but there was no explicit package-level API for parsing that representation back into a UUID. fromString() also supports ULIDs, which share the same 26-character Crockford Base32 shape, so using a dedicated method makes the caller’s intent clear: parse this value as a UUID Base32 value.

This keeps Base32 UUID parsing available through the package API and avoids requiring application code to use the underlying Symfony UID classes directly.

Example:

$uuid = service('uuid')->uuid7();
$base32 = $uuid->toBase32();
$parsed = service('uuid')->fromBase32($base32);

The change includes tests for uppercase input, lowercase input, and invalid input. The user guide was updated with a Base32 parsing example.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

- Add Uuid::fromBase32() for parsing UUID Base32 values
- Cover uppercase, lowercase, and invalid Base32 inputs
- Document Base32 parsing in the README

Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
Copy link
Copy Markdown
Owner

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@michalsn michalsn merged commit 1487a8e into michalsn:develop May 16, 2026
23 of 24 checks passed
@memleakd memleakd deleted the feat/from-base32 branch May 16, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants