1. Go to this page and download the library: Download blobfolio/blob-domain 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/ */
blobfolio / blob-domain example snippets
// Initialize the object by passing a host-like string.
$domain = new blobfolio\domain\domain('www.Google.com');
// Access the sanitized host by typecasting as a string.
echo (string) $domain; //www.google.com
// Get it all. If a part is not applicable, its value will be NULL.
$data = $domain->get_data();
/*
array(
host => www.google.com
subdomain => www
domain => google
suffix => com
)
*/
// Or each part using `get_KEY()`.
echo $domain->get_host(); //www.google.com
echo $domain->get_subdomain(); //www
echo $domain->get_domain(); //google
echo $domain->get_suffix(); //com
// By default, Unicode domains are converted to ASCII.
$domain = new blobfolio\domain\domain('http://☺.com');
echo $domain->get_host(); //xn--74h.com
// Convert them back by passing `TRUE` to the getters.
echo $domain->get_host(true); //☺.com
// As separate actions.
$foo = new blobfolio\domain\domain('www.Google.com');
/*
array(
host => www.google.com
subdomain => www
domain => google
suffix => com
)
*/
$foo->strip_www();
/*
array(
host => google.com
subdomain => NULL
domain => google
suffix => com
)
*/
// Or you can do this at initializing by passing TRUE as a second argument.
$foo = new blobfolio\domain\domain('www.Google.com', true);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.