8000 GitHub - rincler/domain at 1.0.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ domain Public

A domain name value object. Works with IDN and punycode syntax, validates and easily retrieves the level, zone and TLD (top-level domain).

License

Notifications You must be signed in to change notification settings

rincler/domain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Domain

Domain name value object

Usage

$domain = new \Rincler\Domain('sub.domain.com');
echo $domain; // sub.domain.com
echo $domain->getIdn(); // sub.domain.com
echo $domain->getPunycode(); // sub.domain.com
echo $domain->getZone(); // domain.com
echo $domain->getWithoutZone(); // sub
echo $domain->getTld(); // com
echo $domain->getWithoutTld(); // sub.domain
echo $domain->getLevel(); // 3

$domain = new \Rincler\Domain('домен.рф');
echo $domain->getIdn(); // домен.рф
echo $domain->getPunycode(); // xn--d1acufc.xn--p1ai

$domain = new \Rincler\Domain('xn--d1acufc.xn--p1ai');
echo $domain->getIdn(); // домен.рф
echo $domain->getPunycode(); // xn--d1acufc.xnn

Installation

composer require rincler/domain

Documentation

  • static isValid - Returns true if domain is valid, returns false otherwise (bool)
  • __constructor - The constructor validates domain (throws exception if domain is not valid or domain ends with dot) and creates object of domain
  • getIdn - Returns domain as IDN string (string)
  • getPunycode - Returns domain as Punycode string (string)
  • getLevel - Returns domain levels count (int)
  • getZone - Returns zone of domain (\Rincler\Domain)
  • getWithoutZone - Returns domain without zone (\Rincler\Domain)
  • getTld - Returns top-level domain (\Rincler\Domain)
  • getWithoutTld - Returns domain without top-level domain (\Rincler\Domain)
  • equals - Returns true if current domain equals checked domain, returns false otherwise (bool)
  • __toString - Analog for getIdn

About

A domain name value object. Works with IDN and punycode syntax, validates and easily retrieves the level, zone and TLD (top-level domain).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

0