1# Domain
2
3- `v::domain()`
4- `v::domain(boolean $tldCheck = true)`
5
6Validates domain names.
7
8```php
9v::domain()->validate('google.com');
10```
11
12You can skip *top level domain* (TLD) checks to validate internal
13domain names:
14
15```php
16v::domain(false)->validate('dev.machine.local');
17```
18
19This is a composite validator, it validates several rules
20internally:
21
22  * If input is an IP address, it fails.
23  * If input contains whitespace, it fails.
24  * If input does not contain any dots, it fails.
25  * If input has less than two parts, it fails.
26  * Input must end with a top-level-domain to pass (if not skipped).
27  * Each part must be alphanumeric and not start with an hyphen.
28  * [PunnyCode][] is accepted for [Internationalizing Domain Names in Applications][IDNA].
29
30Messages for this validator will reflect rules above.
31
32***
33See also:
34
35  * [Ip](Ip.md)
36  * [MacAddress](MacAddress.md)
37  * [Tld](Tld.md)
38
39[PunnyCode]: http://en.wikipedia.org/wiki/Punycode "Wikipedia: Punnycode"
40[IDNA]: http://en.wikipedia.org/wiki/Internationalized_domain_name#Internationalizing_Domain_Names_in_Applications "Wikipedia: Internationalized domain name"
41