@@ -100,13 +100,31 @@ class Pdp\Uri\Url#6 (8) {
100
100
}
101
101
```
102
102
103
+ ### Convenience Methods
104
+
105
+ A magic __ get() method is provided to access the above object properties. Obtaining the
106
+ public suffix for a parsed domain is as simple as:
107
+
108
+ ``` php
109
+ <?php
110
+
111
+ $host = 'waxaudio.com.au';
112
+ $url = $parser->parseUrl($host);
113
+ $publicSuffix = $url->host->publicSuffix;
114
+
115
+ // $publicSuffix = 'com.au'
116
+ ```
117
+
103
118
### IDNA Support
104
119
120
+ [ IDN (Internationalized Domain Name)] ( http://en.wikipedia.org/wiki/Internationalized_domain_name )
121
+ support was added in version ` 1.4.0 ` . Both unicode domains and their ASCII equivalents
122
+ are supported.
123
+
105
124
#### Unicode
106
125
107
- [ IDN (Internationalized Domain Name)] ( http://en.wikipedia.org/wiki/Internationalized_domain_name )
108
- support was added in 1.4.0. Setting ` $host = 'Яндекс.РФ'; ` (Russian-Cyrillic)
109
- in the previous example would return:
126
+ Parsing IDNA hosts is no different that parsing standard hosts. Setting ` $host = 'Яндекс.РФ'; ` (Russian-Cyrillic)
127
+ in the * Parsing URLs* example would return:
110
128
111
129
```
112
130
class Pdp\Uri\Url#6 (8) {
@@ -141,7 +159,7 @@ class Pdp\Uri\Url#6 (8) {
141
159
#### ASCII (Punycode)
142
160
143
161
If you choose to provide the ASCII equivalent of the unicode domain name
144
- (` $host = 'http://xn--d1acpjx3f.xn--p1ai'; ` in the case of the above example),
162
+ (` $host = 'http://xn--d1acpjx3f.xn--p1ai'; ` in the case of the * Parsing URLs * example),
145
163
the ASCII equivalent will be returned by the parser:
146
164
147
165
```
@@ -174,21 +192,6 @@ class Pdp\Uri\Url#6 (8) {
174
192
}
175
193
```
176
194
177
- ### Convenience Methods
178
-
179
- A magic __ get() method is provided to access the above object properties. Obtaining the
180
- public suffix for a parsed domain is as simple as:
181
-
182
- ``` php
183
- <?php
184
-
185
- $host = 'waxaudio.com.au';
186
- $url = $parser->parseUrl($host);
187
- $publicSuffix = $url->host->publicSuffix;
188
-
189
- // $publicSuffix = 'com.au'
190
- ```
191
-
192
195
### Parsing Domains ###
193
196
194
197
If you'd like to parse the domain (or host) portion only, you can use
0 commit comments