Skip to content

Commit 504828e

Browse files
committed
Update documentation to add support for absolute domain
1 parent e4f8435 commit 504828e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ supported type to avoid unexpected results. By default, if the input is not a
228228
`Pdp\Suffix` instance, the resulting public suffix will be labelled as
229229
being unknown. For more information go to the [Public Suffix section](#public-suffix)
230230

231+
> [!INFO]
232+
> Since version `6.4` Domain resolution is also adapted so that absolute domain
233+
can effectively be resolved. Prior to version `6.4` an exception was thrown.
234+
The `ResolvedDomain` stays the same as with the equivalent non-absolute domain
235+
but with the only difference being that the resolved domain will be absolute.
236+
Everything else stays the same.
237+
231238
### Domain Suffix
232239

233240
The domain effective TLD is represented using the `Pdp\Suffix`. Depending on
@@ -342,6 +349,26 @@ $newDomain->clear()->labels(); //return []
342349
echo $domain->slice(2)->toString(); //display 'www'
343350
~~~
344351

352+
Starting with version `6.4` it is possible to specify and handle absolute domain
353+
with the following methods.
354+
355+
~~~php
356+
<?php
357+
use Pdp\Domain;
358+
use Pdp\Rules;
359+
360+
/** @var Rules $publicSuffixList */
361+
$domain = $publicSuffixList->resolve(Domain::from2008('www.ExAmpLE.cOM'))->domain();
362+
$newDomain = $domain->withRootLabel();
363+
364+
echo $domain->toString(); //display 'www.example.com'
365+
echo $newDomain->toString(); //display 'www.example.com.www.'
366+
$domain->isAbsolute(); //return false
367+
$newDomain->isAbsolute() //return true
368+
369+
$domain->value() === $newDomain->withoutRootLabel()->value();
370+
~~~
371+
345372
> [!WARNING]
346373
> Because of its definition, a domain name can be `null` or a string.
347374

0 commit comments

Comments
 (0)