- What is eig/uuid used for in Laravel applications?
- eig/uuid is a small wrapper around the Ramsey UUID library for generating unique identifiers and exposing helper utilities in Laravel or plain PHP applications. It currently generates version 4 UUIDs according to RFC 4122 and is intended for use in models, database records, and application workflows that prefer UUID-based IDs. Check the repository README for the exact helper classes, methods, and namespaces.
- How do I install eig/uuid with Composer?
- Install it with composer require eig/uuid and then reference the classes or helpers documented in the package README. It is a utility dependency rather than a Laravel service-provider-heavy package, so setup should be minimal. Confirm the supported PHP and Laravel versions before adding it to an existing application.
- Can I use eig/uuid for Laravel request validation?
- Yes, the package's static UUID validator is suited to FormRequests, custom validation rules, API input checks, DTO hydration, and import pipelines. It can complement Laravel's existing validation rules at external input boundaries without changing your domain architecture. Verify the exact method signature, namespace, and accepted UUID formats before replacing hand-rolled regex checks.
- Which UUID version does eig/uuid generate?
- The package currently generates version 4 UUIDs according to RFC 4122 as a wrapper around Ramsey UUID. If you need version 1, version 7, ordered UUIDs, or other variants, use Ramsey UUID directly or confirm whether eig/uuid exposes additional helpers. Treat version support as a documented application requirement.
- What UUID formats does the eig/uuid validator accept?
- The exact accepted formats are not fully specified in the overview, so test canonical hyphenated strings, uppercase input, braces, the nil UUID, binary UUIDs, and non-string inputs before rollout. Semantic strictness matters because a false negative can reject valid client input and a false positive can admit formats your domain does not support. Document the canonical UUID format your application expects and align the validator with that contract.
- Is eig/uuid safe to use in production?
- It is a small, low-coupling utility with negligible runtime and operational impact, making it a low-to-moderate technical risk when used at input boundaries. The main production concerns are format semantics, PHP and Laravel version compatibility, and consistent use instead of mixing it with custom regex checks. Add unit tests for accepted and rejected UUIDs and roll it out in a non-production branch first.
- How should I test eig/uuid generation and validation?
- Write unit tests that confirm generated identifiers are valid RFC 4122 version 4 UUIDs and that your application accepts the canonical format it stores. Add validation tests for uppercase, braces, nil UUID, binary, empty, and non-string inputs so behavior is explicit. If you wrap the static validator in your own service or rule, you can keep domain logic more testable.
- What are alternatives to eig/uuid?
- You can use the underlying Ramsey UUID library directly, Laravel's built-in Str::uuid() helper, or custom validation rules and regex checks. eig/uuid is a focused option when you want a simple wrapper plus UUID helper utilities. Choose based on whether you need validation helpers, specific UUID versions, or ordered identifiers.
- Does eig/uuid require database migrations?
- No, the package generates and validates identifiers; it does not dictate your database schema. You still need to choose appropriate UUID columns, indexes, and model casting in your Laravel application. A patch-level package update should not require data migration, but test your persistence layer anyway.
- How is eig/uuid maintained and what compatibility should I check?
- It is a small utility package, so maintenance and operational surface area are low, but you should still verify its PHP and Laravel support matrix and backward-compatibility policy. The static validator was described as a patch-level addition, which suggests low migration cost, but the exact behavior should be confirmed with tests. Update in a non-production branch, document expected UUID semantics, and apply it first at API, form, queue, or import boundaries.