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 Extra Bundle

Uuid Extra Bundle Laravel Package

mcfedr/uuid-extra-bundle

A Symfony bundle that adds UUID support to your application, including Doctrine types, form types, validators, and generators so you can use UUIDs as primary keys and identifiers with less configuration.

View on GitHub
Deep Wiki
Context7

mcfedr/uuid-extra-bundle is a Symfony bundle that builds on ramsey/uuid to add convenient UUID generator services to your dependency injection container. It registers generators for the common UUID versions, letting you inject and use them directly in your services instead of constructing UUID objects manually throughout your codebase.

  • Ready-to-use service definitions for UUID generation via Symfony's container
  • Supports multiple UUID versions (time-based, random, name-based)
  • Simple configuration and autowiring-friendly aliases
  • Lightweight integration with the ramsey/uuid library
  • Ideal for IDs in entities, messages, and API resources
Frequently asked questions about Uuid Extra Bundle
Can I use mcfedr/uuid-extra-bundle in a Laravel application?
No. It is a Symfony bundle: its features are registered through Symfony's bundle mechanism and dependency injection container, and Laravel never calls getContainerExtension(), so nothing self-activates. The ParamConverter, Normalizer and Form Type it ships all implement Symfony interfaces that Laravel does not run on the request path. In a Laravel app the only live artefact would be the transitive ramsey/uuid dependency, which Laravel already uses internally. Port the roughly 100 to 150 lines of logic instead of installing it.
What does mcfedr/uuid-extra-bundle actually provide?
It adds extra UUID generators on top of ramsey/uuid, including ordered-time, timestamp-first and PECL-backed variants, and exposes them through a convenient UuidGenerator service. On top of that it ships a Symfony ParamConverter for resolving UUID route parameters, a Serializer normalizer and denormalizer, and a Form type for UUID input, plus Doctrine integration for UUID entity identifiers. The generators and the service are the portable part; the three framework integrations are Symfony-specific.
Does mcfedr/uuid-extra-bundle support Laravel 11 or Laravel 12?
No - it does not target Laravel at all, and its last release was 17 January 2022. Its Symfony component version constraints predate Symfony 7.x, which Laravel 11 and 12 pull in transitively, so requiring it can block a framework upgrade rather than fail cleanly at runtime. If you only want UUID support, Laravel 11 and 12 already provide it through ramsey/uuid, Str::uuid(), Str::orderedUuid(), Str::ulid() and the HasUuids and HasUlids traits.
How do I install and register mcfedr/uuid-extra-bundle?
You would run composer require mcfedr/uuid-extra-bundle and register the bundle in config/bundles.php in a Symfony application, where its container extension wires up the converter, normalizer and form type. There is no equivalent step in Laravel: PackageManifest discovers service providers, not bundles, and this package ships no provider. That is precisely why installing it in Laravel adds dependencies without adding behaviour.
What is the Laravel equivalent of the bundle's UUID ParamConverter?
Implicit route model binding. Type-hint the model in the route closure or controller signature and Laravel resolves it by primary key; a malformed UUID fails to match and returns a 404, which is the behaviour the ParamConverter provides in Symfony. For custom lookups use Route::bind() or override getRouteKeyName(). If you also apply a UUID cast to the key, malformed input fails at hydration time as well.
What is the Laravel equivalent of the bundle's UUID normalizer?
Eloquent attribute casts and API Resources. A cast implementing CastsAttributes hydrates a UuidInterface or plain string from storage and serialises it back to canonical form, so both directions live in one class. Then shape outbound payloads in JsonResource::toArray() so the JSON contract is single-sourced. You do not need symfony/serializer anywhere on the request path.
How do I validate a UUID in a Laravel FormRequest?
Use the built-in uuid rule, optionally with a version constraint such as uuid:4 or uuid:7. Because the rule expects canonical hyphenated lowercase form, normalise input first, for example in prepareForValidation(), if clients may send uppercase or hyphenless values. For stricter behaviour add a custom rule that parses with ramsey/uuid and rejects anything that is not exactly the format you store.
How do I use UUIDs as Eloquent primary keys in Laravel?
Set protected $keyType = 'string' and public $incrementing = false on the model and let a cast convert the key to and from canonical string form. Laravel also ships the HasUuids and HasUlids traits, which generate ordered, time-based identifiers on create. Pin ramsey/uuid explicitly in your own composer.json rather than letting a third-party package's constraint decide the version.
Should UUID columns be binary(16) or char(36) in MySQL?
This choice affects performance more than anything the bundle does. binary(16) halves storage and index size but requires a cast on read and write and is unreadable in raw queries, while char(36) is simple and debuggable but larger. Whichever you pick, use ordered time-based UUIDs or ULIDs so inserts stay near the end of the index instead of scattering random v4 values across it.
Is mcfedr/uuid-extra-bundle still maintained, and what should I use instead?
It was last released on 17 January 2022 and has few stars and no dependents, so treat it as unmaintained; SCA and CVE scanners will flag it and no upstream fix should be assumed. Do not install it in a Laravel project. Use ramsey/uuid directly with an Eloquent cast, a validation rule and implicit route binding - the useful logic is small enough to port quickly, and the Symfony components it drags in have no place in a Laravel dependency tree.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo