symfony/polyfill-uuid
Provides polyfills for the uuid extension, adding uuid_* functions on PHP versions where the extension isn’t available. Part of Symfony’s Polyfill suite; lightweight drop-in to improve portability across environments.
Str facade, migrations), eliminating environment-specific UUID inconsistencies. Its alignment with Symfony’s polyfill ecosystem ensures compatibility with Laravel’s existing dependency stack.ext-uuid if available, enabling PHP version upgrades (e.g., 7.4 → 8.0+) without code changes. This reduces technical debt in long-lived applications.random_bytes(), meeting regulatory requirements (HIPAA, PCI DSS) without external dependencies. Ideal for audit trails, financial systems, and healthcare applications.ramsey/uuid, voku/uuid) with zero code changes. Example:
// Before (custom or ramsey/uuid)
$uuid = \Ramsey\Uuid\Uuid::uuid4()->toString();
// After (polyfill)
$uuid = Str::uuid(); // or uuid_generate_v4()
Str::uuid(), Eloquent models, and migrations, ensuring consistency across the stack.v1.36.0. Future-proofs legacy applications during PHP upgrades.symfony/polyfill bundle, reducing integration effort to a single Composer install.ext-uuid due to pure PHP implementation. Mitigation:
ext-uuid for PHP 8.0+ if performance is critical.random_bytes() for cryptographic security. Risks:
--cap-add=SYS_RANDOM, CI/CD) may produce non-compliant UUIDs.--cap-add=SYS_RANDOM to Docker containers.random_bytes() entropy in CI/CD (e.g., fallback to openssl_random_pseudo_bytes()).ramsey/uuid for validation.ramsey/uuid (12K stars) for advanced use cases, though it adds ~50KB to the bundle.ext-uuid be mandated for PHP 8.0+ deployments? If yes, native functions may be preferable for performance-critical paths.ramsey/uuid or another UUID library? Consolidation may reduce complexity.ext-uuid.uuid_* functions?Str facade, Eloquent, and migrations without friction. Reduces technical debt by standardizing UUID generation.ramsey/uuid, voku/uuid, or hardcoded logic).composer.json:
"require": {
"symfony/polyfill-uuid": "^1.36"
}
composer update.Ramsey\Uuid\Uuid::uuid4() with Str::uuid() or uuid_generate_v4().$table->uuid('id')->default(uuid_generate_v4()).random_bytes() entropy in CI/CD pipelines (e.g., Docker with --cap-add=SYS_RANDOM).openssl_random_pseudo_bytes()) if needed.ext-uuid for PHP 8.0+ if performance is critical.ext-uuid if available.laravel/framework, symfony/http-client).Str::uuid().ext-uuid (if available).ext-uuid for PHP 8.0+ deployments if performance is a bottleneck.ramsey/uuid for advanced features (e.g., version 1/3/5 UUIDs).symfony/polyfill bundle.1.36.x) are handled via Composer’s ^ syntax. Major version updates (e.g., 2.0.0) require testing but are unlikely due to Laravel’s long-term support.--cap-add=SYS_RANDOM in Docker or implement openssl_random_pseudo_bytes() as a fallback.ext-uuid or switch to ramsey/uuid for batch generation.Str::uuid() and Eloquent documentation cover most use cases.ext-uuid) is acceptable for most applications.ext-uuid for PHP 8.0+.ramsey/uuid with batch generation.| Failure Scenario | **
How can I help you explore Laravel packages today?