PHP code example of inbox / tld-database

1. Go to this page and download the library: Download inbox/tld-database library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inbox / tld-database example snippets


$store = new \LayerShifter\TLDDatabase\Store();

$store->isExists(string $suffix) : bool;

$store->isExists('com'); // true
$store->isExists('comcom'); // false

$store->isExists(string $suffix): int;

$store->getType('com'); // \LayerShifter\TLDDatabase\Store::TYPE_ICANN = 1
$store->getType('s3.amazonaws.com'); // \LayerShifter\TLDDatabase\Store::TYPE_PRIVATE = 2

$store->isICANN(string $suffix) : bool;

$store->isICANN'com'); // true
$store->isICANN('s3.amazonaws.com'); // false

$store->isPrivate(string $suffix) : bool;

$store->isPrivate('com'); // false
$store->isPrivate('s3.amazonaws.com'); // true

$store = new \LayerShifter\TLDDatabase\Store(string $filename);
$store = new \LayerShifter\TLDDatabase\Store(__DIR__ . '/cache/datatabase.php');

$update = new \LayerShifter\TLDDatabase\Update(string $filename);
$update = new \LayerShifter\TLDDatabase\Update(__DIR__ . '/cache/datatabase.php');

$update->run();

class customHttp implements \LayerShifter\TLDDatabase\Http\AdapterInterface {
    public function get() {} 
}

$update = new \LayerShifter\TLDDatabase\Update(__DIR__ . '/cache/datatabase.php', 'customHttp');
$update->run();