From f1211cde14b0d3bf4ea11150dec6136e29074633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 6 Aug 2025 01:54:54 +0200 Subject: [PATCH 1/3] Document version-specific UUID string validation --- strings.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/strings.md b/strings.md index e0c335b64c..301dc43c49 100644 --- a/strings.md +++ b/strings.md @@ -889,6 +889,21 @@ $isUuid = Str::isUuid('laravel'); // false ``` +You may also validate that the given UUID matches a UUID specification by version (version 1, 3, 4, 5, 6, 7, 8, or one of the "special versions" nil (`00000000-0000-0000-0000-000000000000`) and max (`FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF`)): + +```php +use Illuminate\Support\Str; + +$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', 4); + +// true + +$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', 1); + +// false +``` + + #### `Str::kebab()` {.collection-method} From 047e8e5ec226e3a49a47cf730973ebdf6da2aecf Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 6 Aug 2025 10:20:44 -0500 Subject: [PATCH 2/3] Update strings.md --- strings.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/strings.md b/strings.md index 301dc43c49..b247f39aee 100644 --- a/strings.md +++ b/strings.md @@ -889,16 +889,16 @@ $isUuid = Str::isUuid('laravel'); // false ``` -You may also validate that the given UUID matches a UUID specification by version (version 1, 3, 4, 5, 6, 7, 8, or one of the "special versions" nil (`00000000-0000-0000-0000-000000000000`) and max (`FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF`)): +You may also validate that the given UUID matches a UUID specification by version (1, 3, 4, 5, 6, 7, or 8): ```php use Illuminate\Support\Str; -$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', 4); +$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', version: 4); // true -$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', 1); +$isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', version: 1); // false ``` From 9054f525dbf4b05956478ec11741f83cd9740122 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 6 Aug 2025 10:21:12 -0500 Subject: [PATCH 3/3] Update strings.md --- strings.md | 1 - 1 file changed, 1 deletion(-) diff --git a/strings.md b/strings.md index b247f39aee..44e40ad336 100644 --- a/strings.md +++ b/strings.md @@ -903,7 +903,6 @@ $isUuid = Str::isUuid('a0a2a2d2-0b87-4a18-83f2-2529882be2de', version: 1); // false ``` - #### `Str::kebab()` {.collection-method}