php-extended / php-tld-object
An implementation of the php-tld-interface library
5.0.0
2022-12-12 07:18 UTC
Requires
- php: >=7.3
- php-extended/php-tld-interface: ^5
- php-extended/polyfill-php80-stringable: ^1.2
Requires (Dev)
README
An implementation of the php-tld-interface library.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-tld-object": "^5"
Basic Usage
You may use this library this way to build a hierarchy :
use PhpExtended\Tld\TopLevelDomainHierarchy;
use PhpExtended\Tld\TopLevelDomainNode;
$hierarchy = new TopLevelDomainHierarchy();
$hierarchy->addNode(new TopLevelDomainNode('edu'));
$com = new TopLevelDomainNode('com');
$com->addNode(new TopLevelDomainNode('example');
$hierarchy->addNode($com);
$hierarchy->isTld('example.com'); // true
$hierarchy->isTld('example.edu'); // false
License
MIT (See license file).