Skip to content

Commit 92709ef

Browse files
committed
Improve documentation
1 parent 253c754 commit 92709ef

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

README.md

+34-30
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ You need:
4242

4343
## Usage
4444

45-
**If you are upgrading from version 5 please check the [upgrading guide](UPGRADING.md) for known issues.**
45+
> [!WARNING]
46+
> If you are upgrading from version 5 please check the [upgrading guide](UPGRADING.md) for known issues.
4647
4748
### Resolving Domains
4849

@@ -116,9 +117,10 @@ These methods resolve the domain against their respective data source using
116117
the same rules as the `resolve` method but will instead throw an exception
117118
if no valid effective TLD is found or if the submitted domain is invalid.
118119

119-
**All these methods expect as their sole argument a `Pdp\Host` implementing
120+
> [!CAUTION]
121+
> All these methods expect as their sole argument a `Pdp\Host` implementing
120122
object, but other types (ie: `string`, `null` and stringable objects) are
121-
supported with predefined conditions as explained in the remaining document.**
123+
supported with predefined conditions as explained in the remaining document.
122124

123125
~~~php
124126
<?php
@@ -158,23 +160,18 @@ To instantiate each domain resolver you can use the following named constructor:
158160

159161
**If the instantiation does not work an exception will be thrown.**
160162

161-
**WARNING:**
162-
163-
**You SHOULD never resolve domain name this way in production, without, at
164-
least, a caching mechanism to reduce external resource downloads.**
165-
166-
**Using the Public Suffix List to determine what is a valid domain name and what
163+
> [!WARNING]
164+
> You SHOULD never resolve domain name this way in production, without, at
165+
least, a caching mechanism to reduce external resource downloads.
166+
> Using the Public Suffix List to determine what is a valid domain name and what
167167
isn't is dangerous, and MAY lead to errors because of new gTLDs being registered
168-
on a regular basis.**
169-
170-
**If you are looking to know the validity of a Top Level Domain, you MUST use
168+
on a regular basis.
169+
> If you are looking to know the validity of a Top Level Domain, you MUST use
171170
the IANA Top Level Domain List as the proper source for this information or
172-
alternatively the DNS.**
173-
174-
**If you MUST use this library for any of the above purposes, you SHOULD consider
175-
integrating an updating mechanism into your software.**
176-
177-
**For more information go to the [Managing external data source section](#managing-the-package-external-resources)**
171+
alternatively the DNS.
172+
> If you MUST use this library for any of the above purposes, you SHOULD consider
173+
integrating an updating mechanism into your software.
174+
> For more information go to the [Managing external data source section](#managing-the-package-external-resources)**
178175
179176
### Resolved domain information.
180177

@@ -221,10 +218,11 @@ echo $altResult->domain()->toString(); //display 'foo.bar.test.example';
221218
$altResult->suffix()->isKnown(); //return false;
222219
~~~
223220

224-
**TIP: Always favor submitting a `Pdp\Suffix` object rather that any other
221+
> [!TIP]
222+
> Always favor submitting a `Pdp\Suffix` object rather that any other
225223
supported type to avoid unexpected results. By default, if the input is not a
226224
`Pdp\Suffix` instance, the resulting public suffix will be labelled as
227-
being unknown. For more information go to the [Public Suffix section](#public-suffix)**
225+
being unknown. For more information go to the [Public Suffix section](#public-suffix)
228226

229227
### Domain Suffix
230228

@@ -340,7 +338,8 @@ $newDomain->clear()->labels(); //return []
340338
echo $domain->slice(2)->toString(); //display 'www'
341339
~~~
342340

343-
**WARNING: Because of its definition, a domain name can be `null` or a string.**
341+
> [!WARNING]
342+
> Because of its definition, a domain name can be `null` or a string.
344343
345344
To distinguish this possibility the object exposes two (2) formatting methods
346345
`Domain::value` which can be `null` or a `string` and `Domain::toString` which
@@ -397,8 +396,9 @@ is done via two (2) named constructors:
397396
At any given moment the `Pdp\Domain` instance can tell you whether it is in
398397
`ASCII` mode or not.
399398

400-
**Once instantiated there's no way to tell which algorithm is used to convert
401-
the object from ascii to unicode and vice-versa**
399+
> [!WARNING]
400+
> Once instantiated there's no way to tell which algorithm is used to convert
401+
the object from ascii to unicode and vice-versa
402402

403403
~~~php
404404
use Pdp\Domain;
@@ -420,10 +420,11 @@ echo $asciiDomain->value(); // display 'fass.de'
420420
$asciiDomain->isAscii(); // returns true
421421
~~~
422422

423-
**TIP: Always favor submitting a `Pdp\Domain` object for resolution rather that a
423+
> [!TIP]
424+
> Always favor submitting a `Pdp\Domain` object for resolution rather that a
424425
string or an object that can be cast to a string to avoid unexpected format
425426
conversion errors/results. By default, and with lack of information conversion
426-
is done using IDNA 2008 rules.**
427+
is done using IDNA 2008 rules.
427428

428429
### Managing the package external resources
429430

@@ -470,7 +471,8 @@ on packagist.
470471

471472
#### Refreshing the resource using the provided factories
472473

473-
**THIS IS THE RECOMMENDED WAY OF USING THE LIBRARY**
474+
> [!NOTE]
475+
> THIS IS THE RECOMMENDED WAY OF USING THE LIBRARY
474476
475477
For the purpose of this example we will use our PSR powered solution with:
476478

@@ -527,12 +529,14 @@ $publicSuffixList = $pslStorage->get(PsrStorageFactory::PUBLIC_SUFFIX_LIST_URI);
527529
$topLevelDomains = $rzdStorage->get(PsrStorageFactory::TOP_LEVEL_DOMAIN_LIST_URI);
528530
~~~
529531

530-
**Be sure to adapt the following code to your own application.
532+
> [!NOTE]
533+
> Be sure to adapt the following code to your own application.
531534
The following code is an example given without warranty of it working
532-
out of the box.**
535+
out of the box.
533536

534-
**You should use your dependency injection container to avoid repeating this
535-
code in your application.**
537+
> [!WARNING]
538+
> You should use your dependency injection container to avoid repeating this
539+
code in your application.
536540

537541
### Automatic Updates
538542

0 commit comments

Comments
 (0)