qwddz / domain-extractor
Installs: 5 683
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.3 || ^8.0
- ext-curl: *
- ext-json: *
- symfony/polyfill-intl-idn: ^1.10
Requires (Dev)
- phpmd/phpmd: @stable
- phpunit/phpunit: ^8.5
- squizlabs/php_codesniffer: *
README
Via Composer
$ composer require qwddz/domain-extractor
Usage
$extract = new Extract(); # For domain 'gist.github.com' $result = $extract->parse('shop.github.com'); $result->getFullHost(); // will return (string) 'shop.github.com' $result->getRegistrableDomain(); // will return (string) 'github.com' $result->isValidDomain(); // will return (bool) true $result->isIp(); // will return (bool) false # For IP '127.0.0.1' $result = $extract->parse('192.168.0.1'); $result->getFullHost(); // will return (string) '192.168.0.1' $result->getRegistrableDomain(); // will return null $result->isValidDomain(); // will return (bool) false $result->isIp(); // will return (bool) true