php-extended/php-tld-object

An implementation of the php-tld-interface library

4.0.0 2022-05-31 07:22 UTC

README

An implementation of the php-tld-interface library.

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-tld-object": "^3"
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

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).