code: private function getDomain($text)
      {
          try {
              $domain = array();
              $url = $this->parser->parseUrl(trim($text));
  
              $domain['tld'] = $url->host->publicSuffix;
              $registerableDomainParts = explode('.', $url->host->registerableDomain);
              $domain['sld'] = $registerableDomainParts[0];
              $domain['host'] = $url->host;
              $domain['path'] = implode('/', array_reverse($registerableDomainParts)) . '.txt';
  
              return $domain;
          } catch (\Exception $e) {
              return null;
          }
      }
docs: Retrieves domain information including top-level domain (tld),
  second-level domain (sld), and host information.
  
  @param  string     $text Email address or domain name
  @return array|null array of domain information if found, null if error.