laravel-domain-parser icon indicating copy to clipboard operation
laravel-domain-parser copied to clipboard

How to use DomainParser facade?

Open jordanade opened this issue 2 years ago • 2 comments

Please provide examples.

jordanade avatar Jan 14 '23 04:01 jordanade

Hi! Anything specific you would like to know about?

Even though this issue is related to #24, I'll leave it open until fixed.

kevindierkx avatar Jan 16 '23 10:01 kevindierkx

Thank you Kevin. The idea of using the resolve() method on what is presented as a "list" object wasn't obvious at all. Finally figured it out by cross-referencing the PDP documentation. I'll leave this here for others:

$pdp = app('pdp.rules')->resolve($raw_domain);
$registrable_domain = $pdp->registrableDomain()->toString();
$tld = $pdp->suffix()->toString();

jordanade avatar Jan 16 '23 10:01 jordanade