This repository was archived by the owner on Jan 31, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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+ ```
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments