symfony/polyfill-uuid
Symfony polyfill for the PHP uuid extension. It provides the uuid_* functions on PHP installations without ext-uuid, so applications and libraries can use UUID helpers without requiring the extension. Lightweight, MIT-licensed, and maintained by Symfony.
This package is infrastructure, not a product feature. It supports decisions about runtime support, deployment portability, and whether to build or buy UUID compatibility plumbing.
ext-uuid is unavailable—shared hosting, minimal containers, serverless, CI/CD—without writing or maintaining a custom UUID fallback.uuid_* compatibility in-house. It auto-defers to the native ext-uuid extension when present, so adopting it does not block future performance work.uuid_* functions working during PHP upgrades without refactoring UUID logic.random_bytes() for identifiers used in audit trails and operational records. It is not a complete security control; entropy and validation requirements still need review.Adopt when:
uuid_* functions and target PHP runtimes without ext-uuid.uuid_* functions and want to avoid refactoring UUID code during upgrades.ext-uuid when available.uuid_* function coverage, including recent v1/v4/v6/v7/vendor-type alignment, and do not need a full UUID abstraction.Look elsewhere when:
ext-uuid is guaranteed across all environments and UUID generation is performance-critical; native functions are faster.ramsey/uuid or equivalent.Str::uuid() or Eloquent UUID keys with full library behavior; this polyfill is not a replacement for a full UUID library.ext-uuid where possible.SYS_RANDOM or otherwise test random_bytes(); mitigate entropy risk before adopting.Executives: This is a low-cost risk reducer, not a product feature. It removes environment-specific UUID failures and lets us run on serverless, legacy, or restricted hosting without PECL extensions. It is MIT-licensed, Symfony-maintained, and automatically defers to native PHP functions when available. Recommendation: accept it as transitive infrastructure, document the supported runtime matrix, and avoid building a custom UUID fallback.
Engineering: Treat this as a Composer-level compatibility shim. If our code or dependencies call uuid_* functions, it makes them work without ext-uuid and defers to native when present. There is no runtime configuration. It is not a substitute for ramsey/uuid when we need validation, v3/v5 namespaces, or Laravel’s full UUID API. Audit composer.lock for duplicate UUID approaches, benchmark only if UUID generation becomes hot-path, and ensure entropy is available in Docker/CI before relying on random_bytes().
How can I help you explore Laravel packages today?