File tree 3 files changed +16
-8
lines changed
3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 2
2
3
3
All Notable changes to ` PHP Domain Parser ` ** 5.x** series will be documented in this file
4
4
5
- ## Next - TBD
5
+ ## 5.3.0 - 2018-05-22
6
6
7
7
### Added
8
8
@@ -26,6 +26,7 @@ All Notable changes to `PHP Domain Parser` **5.x** series will be documented in
26
26
- ` Pdp\Domain ` and ` Pdp\PublicSuffix ` host validation compliance to RFC improved
27
27
- Improve ` Pdp\Converter ` and ` Pdp\Manager ` class to better report error on IDN conversion.
28
28
- Improve ` Pdp\Installer ` vendor directory resolution see [ PR #222 ] ( https://github.com/jeremykendall/php-domain-parser/pull/222 )
29
+ - ` Pdp\Exception ` nows extends ` InvalidArgumentException ` instead of ` RuntimeException `
29
30
30
31
### Deprecated
31
32
Original file line number Diff line number Diff line change 51
51
use Pdp\Cache;
52
52
use Pdp\CurlHttpClient;
53
53
use Pdp\Manager;
54
+ use Pdp\Rules;
54
55
55
56
$manager = new Manager(new Cache(), new CurlHttpClient());
56
57
$rules = $manager->getRules(); //$rules is a Pdp\Rules object
@@ -66,11 +67,17 @@ $domain->isICANN(); // returns true
66
67
$domain->isPrivate(); // returns false
67
68
68
69
69
- $altDomain = $rules->getPublicSuffix('thephpleague.github.io'); //$altDomain is a Pdp\PublicSuffix object
70
- echo $altDomain->getContent(); // 'github.io'
71
- $altDomain->isKnown(); // returns true
72
- $altDomain->isICANN(); // returns false
73
- $altDomain->isPrivate(); // returns true
70
+ $publicSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::PRIVATE_DOMAINS); //$publicSuffix is a Pdp\PublicSuffix object
71
+ echo $publicSuffix->getContent(); // 'github.io'
72
+ $publicSuffix->isKnown(); // returns true
73
+ $publicSuffix->isICANN(); // returns false
74
+ $publicSuffix->isPrivate(); // returns true
75
+
76
+ $altSuffix = $rules->getPublicSuffix('mydomain.github.io', Rules::ICANN_DOMAINS);
77
+ echo $altSuffix->getContent(); // 'io'
78
+ $altSuffix->isKnown(); // returns true
79
+ $altSuffix->isICANN(); // returns true
80
+ $altSuffix->isPrivate(); // returns false
74
81
~~~
75
82
76
83
Using the above code you have parse, validate and resolve a domain name and its public suffix status against the Public Suffix list.
Original file line number Diff line number Diff line change 15
15
16
16
namespace Pdp ;
17
17
18
- use RuntimeException ;
18
+ use InvalidArgumentException ;
19
19
20
- class Exception extends RuntimeException
20
+ class Exception extends InvalidArgumentException
21
21
{
22
22
}
You can’t perform that action at this time.
0 commit comments