diff --git a/en/appendices/5-3-migration-guide.rst b/en/appendices/5-3-migration-guide.rst index cfc1a64e5c..50c0a78c5d 100644 --- a/en/appendices/5-3-migration-guide.rst +++ b/en/appendices/5-3-migration-guide.rst @@ -112,3 +112,10 @@ TestSuite - ``assertRedirectBack()`` added to assert a successful redirect has been made to the same previous URL. - ``assertRedirectBackToReferer()`` added to assert a successful redirect has been made to the referer URL. + +Utility +------- + +- ``Text::uuid()`` now supports configurable UUID generation. You can set a custom + UUID generator using ``Configure::write('Text.uuidGenerator', $closure)`` to + integrate your own UUID generation strategy or third-party libraries. diff --git a/en/core-libraries/text.rst b/en/core-libraries/text.rst index 30d0111958..6e91bcc42a 100644 --- a/en/core-libraries/text.rst +++ b/en/core-libraries/text.rst @@ -97,6 +97,24 @@ UUID is a 128-bit string in the format of Text::uuid(); // 485fc381-e790-47a3-9794-1337c0a8fe68 +.. versionadded:: 5.3.0 + You can now configure a custom UUID generator using dependency injection. + +Starting from CakePHP 5.3.0, you can configure a custom UUID generator by +setting a closure in your configuration:: + + // In your config/app.php or config/bootstrap.php + use Cake\Core\Configure; + + Configure::write('Text.uuidGenerator', function () { + // Return your custom UUID string + return \MyUuidLibrary::generate(); + }); + +This allows you to integrate your own UUID generation strategy or use +third-party UUID libraries. When a custom generator is configured, it will +be used instead of the default UUID generation method. + Simple String Parsing =====================