yocto/yoclib-multibase
A PHP library for Multibase encoding and decoding, enabling self-describing base-encoded strings with prefix handling. Suitable for IPFS, CID, and decentralized identifier tooling that needs consistent support across multiple base encodings.
What the package actually is. yocto/yoclib-multibase is a single-purpose codec library implementing the Multibase spec: it takes a byte string and produces a self-describing encoded string (a one-character prefix identifying the base — base16, base32, base36, base58btc, base64url, etc.) and reverses it. It sits in the multiformats family alongside Multihash, Multicodec, and CID. It is not Laravel-aware and has no framework surface area. v1.2.0 materially expands the spec surface: it adds Base45, Proquint, and Base256emoji, updates the test suite, and makes prefix-code detection UTF-8 aware (necessary because Base256emoji uses a multi-byte emoji as its prefix character). The package is now closer to spec-complete, but the new bases are also the least-exercised code in the tree.
Architecture fit. Unchanged at the core: pure utility, stateless, no I/O, no config, no persistence — the easiest possible integration profile. Two new wrinkles from v1.2.0:
utf8mb4 (MySQL), UTF-8-clean collation, and JSON serialization that does not mangle surrogate pairs. That is a data-layer concern, not an architecture one, but it is new surface area the original assessment did not contemplate.The fundamental question is still whether you need Multibase at all. If your requirement is base58btc or base64url for CIDs, DIDs, or VCs, v1.2.0 adding Base45/Proquint/Base256emoji does not make it more relevant — it makes it a larger dependency for a two-base use case.
Technical risk — this is still the dominant concern, and v1.2.0 does not change any of the load-bearing risks.
The new encodings add two risks worth naming. Base256emoji and Proquint are relatively obscure Multibase profiles; there are few independent implementations to cross-check against, so a spec-drift bug is harder to detect from the outside. And the UTF-8 change to code detection alters a shared code path used by all bases — a regression there would affect base16/base32/base58btc as well as the emoji prefix. That is the one line in the release notes that should make you re-run your full vector suite, not just the new cases.
Key questions to resolve before commitment (updated for v1.2.0):
utf8mb4), JSON, and log pipeline? Emoji in IDs is a real ergonomics and storage tax.Stack fit. Unchanged. Framework-agnostic PSR-4 package, composer-installable into Laravel 9/10/11 with no service provider required. Keep the integration seam as before: (a) a thin MultibaseCodec interface in your domain layer, (b) an adapter against this package, (c) an optional service provider binding it. Add a capability enum or interface method that enumerates the bases you actually support, so that the presence of Base45/Proquint/Base256emoji in the package does not silently become part of your product contract.
Migration path / alternatives. Unchanged in shape, but v1.2.0 sharpens the argument for containment. The two viable paths remain:
1.2.0), vendor the source, keep a patch branch. Your first CI job after upgrade should be the full multibase vector suite, not just the new bases — the UTF-8 detection change touches every code path.base16, base32, base58btc, base64url (still ~95% of real-world use), the new encodings don't enter the calculus. A few hundred lines plus vectors — low-cost, eliminates license and bus-factor risk, and is unaffected by upstream's detection rewrite.Recommendation stands: prototype the wrapper first, measure which of the package's bases you actually invoke, then decide adopt-with-vendor vs. reimplement. v1.2.0 is an argument for the wrapper, not for or against adoption.
Compatibility. Verify PHP floor against your runtime as before. Two v1.2.0-specific checks:
utf8mb4 on any column or JSON field that could receive Base256emoji output; confirm logs, queues, and webhooks do not truncate emoji.gmp, bcmath, or mbstring for the new codecs beyond your deploy image and CI. Emoji handling in particular usually implies mbstring.Sequencing (updated):
1.2.0, document update cadence.Maintenance. Effectively zero upstream support; unchanged. v1.2.0 is evidence the maintainer is actively extending the library, which lowers (but does not eliminate) abandonment risk — but three new codecs means three new areas you may be forced to own. Budget a named engineer, a quarterly upstream review, and a standing fork. Pin hard to 1.2.0: if the codec touches persisted identifiers, a silent change to UTF-8 prefix detection would be a data-integrity incident on read, not just a decode failure. Keep the vector suite permanently in CI.
Support. No vendor, no SLA, no community. The ADR now needs to name which bases your product emits and why — and explicitly record that Base45, Proquint, and Base256emoji are available in the dependency but out of product scope unless a requirement says otherwise. Documenting the out-of-scope list prevents later adoption by accident.
Scaling. Still not a concern for typical identifier sizes. Two new watch-items:
Failure modes to design for (updated):
null/false/throwing inconsistently — normalize at the adapter.utf8mb4.gmp/bcmath at boot or fail fast.Ramp-up. Technical ramp-up remains under an hour for the API; multiformats concepts take half a day. v1.2.0 raises the organizational ramp-up slightly: a reviewer will now ask why a package that ships emoji encodings is in a payments/identity codebase when you use two bases, and the answer — "allowlisted to four bases, wrapped, vendored, GPL reviewed" — needs to be written down. The defensible TPM position is unchanged: use only if Multibase interop is a hard product requirement, wrap it behind an interface, pin to 1.2.0, allowlist the bases you need, vendor it, and keep the in-house reimplementation scoped as the fallback — or skip it and write the two or three bases you actually need. The v1.2.0 feature expansion does not change that calculus; if anything, it strengthens the case for narrow, wrapped adoption.
How can I help you explore Laravel packages today?