You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,8 @@ All Notable changes to `PHP Domain Parser` **5.x** series will be documented in
6
6
7
7
### Added
8
8
9
-
- Support for `IDNA_OPTIONS` settings in all the classes see [#236](https://github.com/jeremykendall/php-domain-parser/pull/236) thanks to [Insolita](https://github.com/Insolita)
9
+
- Support for IDNA options see [#236](https://github.com/jeremykendall/php-domain-parser/pull/236) thanks to [Insolita](https://github.com/Insolita).
10
+
10
11
-`PublicSuffix::labels` and `Domain::labels` to return the VO labels see [#241](https://github.com/jeremykendall/php-domain-parser/pull/241)
@@ -135,6 +162,8 @@ public function Domain::append($label): Domain
135
162
public function Domain::prepend($label): Domain
136
163
public function Domain::withPublicSuffix($publicSuffix): Domain
137
164
public function Domain::withSubDomain($subDomain): Domain
165
+
public function Domain::withAsciiIDNAOption(int $option): Domain
166
+
public function Domain::withUnicodeIDNAOption(int $option): Domain
138
167
~~~
139
168
140
169
~~~php
@@ -162,7 +191,6 @@ Because the `Pdp\Domain` object is immutable:
162
191
163
192
**WARNING: URI and URL accept registered name which encompass domain name. Therefore, some URI host are invalid domain name and will trigger an exception if you try to instantiate a `Pdp\Domain` with them.**
164
193
165
-
166
194
The `Pdp\Domain` object can tell whether a public suffix can be attached to it using the `Pdp\Domain::isResolvable` method.
167
195
168
196
~~~php
@@ -222,11 +250,27 @@ namespace Pdp;
222
250
223
251
final class Rules
224
252
{
225
-
public static function createFromPath(string $path, $context = null): Rules
226
-
public static function createFromString(string $content): Rules
227
-
public function __construct(array $rules)
253
+
public static function createFromPath(
254
+
string $path, $context = null,
255
+
int $asciiIDNAOption = IDNA_DEFAULT,
256
+
int $unicodeIDNAOption = IDNA_DEFAULT
257
+
): Rules
258
+
public static function createFromString(
259
+
string $content,
260
+
int $asciiIDNAOption = IDNA_DEFAULT,
261
+
int $unicodeIDNAOption = IDNA_DEFAULT
262
+
): Rules
263
+
public function __construct(
264
+
array $rules,
265
+
int $asciiIDNAOption = IDNA_DEFAULT,
266
+
int $unicodeIDNAOption = IDNA_DEFAULT
267
+
): void
228
268
public function resolve($domain, string $section = ''): Domain
229
269
public function getPublicSuffix($domain, string $section = ''): PublicSuffix
270
+
public function getAsciiIDNAOption(): int
271
+
public function getUnicodeIDNAOption(): int
272
+
public function withAsciiIDNAOption(int $asciiIDNAOption): Rules
273
+
public function withUnicodeIDNAOption(int $unicodeIDNAOption): Rules
230
274
}
231
275
~~~
232
276
@@ -304,12 +348,16 @@ namespace Pdp;
304
348
305
349
final class TopLevelDomains implements Countable, IteratorAggregate
306
350
{
307
-
public static function createFromPath(string $path, $context = null): Rules
308
-
public static function createFromString(string $content): Rules
309
-
public function __construct(array $records, string $version, DateTimeInterface $modifiedDate)
351
+
public static function createFromPath(string $path, $context = null, int $asciiIDNAOption = IDNA_DEFAULT, int $unicodeIDNAOption = IDNA_DEFAULT): Rules
352
+
public static function createFromString(string $content, int $asciiIDNAOption = IDNA_DEFAULT, int $unicodeIDNAOption = IDNA_DEFAULT): Rules
353
+
public function __construct(array $records, string $version, DateTimeInterface $modifiedDate, int $asciiIDNAOption = IDNA_DEFAULT, int $unicodeIDNAOption = IDNA_DEFAULT)
310
354
public function resolve($domain): Domain
311
355
public function contains($domain): bool
312
356
public function isEmpty(): bool
357
+
public function getAsciiIDNAOption(): int
358
+
public function getUnicodeIDNAOption(): int
359
+
public function withAsciiIDNAOption(int $option): TopLevelDomains
360
+
public function withUnicodeIDNAOption(int $option): TopLevelDomains
public function __construct(CacheInterface $cache, HttpClient $http, $ttl = null)
356
-
public function getRules(string $source_url = self::PSL_URL, $ttl = null): Rules
357
-
public function refreshRules(string $source_url = self::PSL_URL, $ttl = null): bool
358
-
public function getTLDs(string $source_url = self::RZD_URL, $ttl = null): Rules
359
-
public function refreshTLDs(string $source_url = self::RZD_URL, $ttl = null): bool
360
404
}
361
405
~~~
362
406
@@ -376,7 +420,6 @@ The `$ttl` argument can be:
376
420
377
421
**the `$ttl` argument is added to improve PSR-16 interoperability**
378
422
379
-
380
423
The `Pdp\HttpClient` is a simple interface which exposes the `HttpClient::getContent` method. This method expects a string URL representation has its sole argument and returns the body from the given URL resource as a string.
381
424
If an error occurs while retrieving such body a `HttpClientException` exception is thrown.
382
425
@@ -414,7 +457,8 @@ public Manager::refreshRules(string $source_url = self::PSL_URL, $ttl = null): b
414
457
public Manager::refreshTLD(string $source_url = self::RZD_URL, $ttl = null): bool
415
458
~~~
416
459
417
-
The both methods method enables refreshing your local copy of the stored resources with your [PSR-16](http://www.php-fig.org/psr/psr-16/) Cache and retrieved using the Http Client. By default the method will use the resource default source URL but you are free to substitute this URL with your own.
460
+
The both methods method enables refreshing your local copy of the stored resources with your [PSR-16](http://www.php-fig.org/psr/psr-16/) Cache and retrieved using the Http Client. By default the method will use the resource default source URL but you are free to substitute this URL with your own.
461
+
418
462
The method returns a boolean value which is `true` on success.
419
463
420
464
~~~php
@@ -432,8 +476,19 @@ if ($retval) {
432
476
~~~php
433
477
<?php
434
478
435
-
public Manager::getRules(string $source_url = self::PSL_URL, $ttl = null): Rules
436
-
public Manager::getTLDs(string $source_url = self::RZD_URL, $ttl = null): TopLevelDomains
479
+
public Manager::getRules(
480
+
string $source_url = self::PSL_URL,
481
+
$ttl = null,
482
+
int $asciiIDNAOption = IDNA_DEFAULT,
483
+
int $unicodeIDNAOption = IDNA_DEFAULT
484
+
): Rules
485
+
486
+
public Manager::getTLDs(
487
+
string $source_url = self::RZD_URL,
488
+
$ttl = null,
489
+
int $asciiIDNAOption = IDNA_DEFAULT,
490
+
int $unicodeIDNAOption = IDNA_DEFAULT
491
+
): TopLevelDomains
437
492
~~~
438
493
439
494
These methods returns a `Pdp\Rules` or `Pdp\TopLevelDomains` objects seeded with their corresponding data fetch from the cache or from the external resources depending on the submitted `$ttl` argument.
@@ -445,6 +500,17 @@ These methods take an optional `$source_url` argument which specifies the PSL so
445
500
446
501
On error, theses methods will throw an `Pdp\Exception`.
447
502
503
+
**since 5.5***
504
+
505
+
the following optional arguments are added to the methods:
506
+
507
+
-`$asciiIDNAOption` optional IDNA option for ascii conversion;
508
+
-`$asciiIDNAOption` optional IDNA option for unicode conversion;
509
+
510
+
**theses arguments are a combination of `IDNA_*` constants (except `IDNA_ERROR_*` constants).**
511
+
512
+
They are used when instantiated the returned object.
513
+
448
514
**THIS IS THE RECOMMENDED WAY OF USING THE LIBRARY**
0 commit comments