Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Uuid Encoder Bundle

Uuid Encoder Bundle Laravel Package

gubler/uuid-encoder-bundle

Symfony bundle integrating the gubler/uuid-encoder library, enabling conversion of UUIDs to shorter, URL-friendly encoded strings and decoding them back within Symfony applications, with service configuration for easy use.

View on GitHub
Deep Wiki
Context7

Provides Symfony integration with gubler/uuid-encoder

Frequently asked questions about Uuid Encoder Bundle
Is gubler/uuid-encoder-bundle compatible with Laravel?
Not out of the box. This package is a Symfony bundle: it registers the encoder as a Symfony service so it can be autowired through the Symfony container. Laravel does not read Symfony bundle configuration, so you cannot simply install it and expect a bound service there. In a Laravel app you would typically depend on the underlying gubler/uuid-encoder library directly and resolve or instantiate the encoder yourself, for example from a service provider binding or a small helper.
How do I install gubler/uuid-encoder-bundle with Composer?
Install it with Composer using the package name gubler/uuid-encoder-bundle. In a Symfony application using Symfony Flex, the bundle recipe is normally enabled automatically; otherwise you register the bundle in your bundles configuration file. Once installed, the encoder service is available for dependency injection, so you can type-hint it in a controller or service constructor. Check the README for the exact class name to type-hint against.
How do I encode a UUID into a short URL-safe string?
Inject the encoder service into your controller, command, or any other service and call its encode method with the UUID you want to shorten. The result is a compact, base-converted string that is safe to place in routes, permalinks, or API payloads. Because the service is container-managed, no manual instantiation or configuration is required in a Symfony app. The operation is a pure string transformation and does not touch the database.
Can I decode a shortened identifier back into the original UUID?
Yes. The encoding is fully reversible, so decoding an encoded string returns the original UUID rather than an approximation. This is what makes the short form safe to expose in URLs and accept back on incoming requests. Decode early in your request handling, then use the standard UUID for lookups or comparisons. If the input is malformed, expect an exception, so wrap decoding in validation or a try/catch.
Does the bundle accept binary UUID values as well as strings?
Yes. The bundle handles both RFC 4122 style string identifiers, such as the familiar 36-character hyphenated form, and raw binary UUID values. That matters if your database stores UUIDs as BINARY(16) instead of CHAR(36), because you can encode directly from the stored value. The output is the same compact, URL-friendly string either way, and decoding restores the original representation you need.
Which Symfony versions does this bundle support?
The exact supported range is defined by the bundle's composer.json and the tagged releases, so check the require section and the README before upgrading. Because the bundle is a thin integration layer around the encoder library, it generally follows the framework's bundle and service configuration conventions. If you are on an older Symfony version, verify that the release you install declares compatibility rather than assuming it.
How should I test code that uses the UUID encoder?
The encoder is a deterministic, dependency-free transformation with no I/O, which makes it straightforward to unit test: encode a known UUID, assert the exact short string, then decode it and assert you get the original value back. In Symfony functional tests the service can be pulled from the test container like any other service. In Laravel, bind the encoder in a service provider so tests resolve the same instance the application uses. Add a test for malformed input if you expose decoding to user-supplied route parameters.
Are encoded UUIDs safe to use in URLs and route parameters?
Yes. The encoded output is URL-friendly by design and contains no characters that need escaping in a path segment. That is the main reason to use it instead of the hyphenated 36-character form, since routes, permalinks, and API responses become noticeably shorter. Treat the short string as an identifier, not a security control: it is reversible, so anyone who receives it can recover the underlying UUID. If a UUID must stay secret, keep it out of public URLs entirely.
Do I need to change my database schema to use this bundle?
No. The bundle performs an in-memory conversion only, so there are no migrations, extra columns, or storage requirements. A common pattern is to keep storing the native UUID in the database and encode only at the boundary, when building URLs or API output, then decode on the way back in. That keeps your schema and queries unchanged while still giving you short identifiers externally.
How is this bundle maintained, and what are the alternatives?
It is a small, single-maintainer package whose scope is deliberately narrow: wrapping the gubler/uuid-encoder library as a Symfony service. Since it does no database work and has no heavy dependencies, it has little surface area to break, but you should still check release activity and issue history before adopting it in a long-lived project. Alternatives include shortener packages such as hashids-style encoders, base62 UUID libraries, or simply implementing a base-conversion routine yourself if you only need one call site. In Laravel specifically, using the underlying encoder library directly is usually simpler than adding a Symfony bundle.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package