Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit c160008

Browse files
committed
Added documentation
Adds documentation for the UUID validator
1 parent 60d2aa4 commit c160008

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

doc/book/set.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The following validators come with the zend-validator distribution.
2929
- [StringLength](validators/string-length.md)
3030
- [Timezone](validators/timezone.md)
3131
- [Uri](validators/uri.md)
32+
- [Uuid](validators/uuid.md)
3233

3334
## Additional validators
3435

doc/book/validators/uuid.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# UUID Validator
2+
3+
`Zend\Validator\Uuid` allows validating [Universally Unique IDentifiers](https://en.wikipedia.org/wiki/Universally_unique_identifier)
4+
(UUIDs). UUIDs are 128-bit values that are guaranteed to be "practically unique"
5+
in order to help prevent identifier conflicts. Five separate UUID versions
6+
exist:
7+
8+
- Version 1, which uses a combination of date-time and hardware MAC addresses to
9+
generate the hash.
10+
- Version 2, which uses a combination of date-time and system user/group identifiers.
11+
- Version 3, which uses an MD5sum of a URI or distinguished name to generate the
12+
hash.
13+
- Version 4, which uses a CSPRNG to generate the hash.
14+
- Version 5, which uses the same idea as Version 3, but using SHA-1 for hashing.
15+
16+
The `Uuid` validator is capable of validating whether a string is a valid UUID
17+
of any version. It does not validate that the UUID exists in your system,
18+
however, only that it is well-formed.
19+
20+
> ### Introduced in 2.8.0
21+
>
22+
> `Zend\Validator\Uuid` was introduced with version 2.8.0.
23+
24+
## Supported options
25+
26+
The `Uuid` validator has no additional options.
27+
28+
## Basic usage
29+
30+
```php
31+
$validator = new Zend\Validator\Uuid();
32+
33+
if ($validator->isValid($uuid)) {
34+
// UUID was valid
35+
} else {
36+
// Invalid/mal-formed UUID; use $validator->getMessages() for more detail
37+
}
38+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pages:
3535
- StringLength: validators/string-length.md
3636
- Timezone: validators/timezone.md
3737
- Uri: validators/uri.md
38+
- Uuid: validators/uuid.md
3839
- "File Validators":
3940
- Intro: validators/file/intro.md
4041
- Count: validators/file/count.md

0 commit comments

Comments
 (0)