PHP code example of webtigers / tld-rules

1. Go to this page and download the library: Download webtigers/tld-rules 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/ */

    

webtigers / tld-rules example snippets


use WebTigers\TldRules\Catalog;

$cat = Catalog::default();                       // the bundled catalog

$cat->privacySupported('example.us');            // false — .us has no WHOIS privacy
$cat->privacySupported('example.com');           // true
$cat->periodBounds('example.com');               // [1, 10]

$cat->hasRequirements('example.ca');             // true
$cat->']]],
// ]

// Validate a buyer's submitted extended attributes before you try to register:
$errors = $cat->validate('example.us', ['category' => 'C11', 'app_purpose' => 'P3']);
// []  — valid

$errors = $cat->validate('example.us', []);
// ['Nexus category is 

$cat = new Catalog('/path/to/your/tld-rules.json');