Skip to content

Commit 4e931e8

Browse files
committed
Merge branch 'develop'
2 parents 686e1ff + c74ada7 commit 4e931e8

22 files changed

+2146
-881
lines changed

.php_cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
require_once './vendor/autoload.php';
4+
5+
$finder = \Symfony\CS\Finder\DefaultFinder::create()
6+
->in('src/')
7+
->in('tests/');
8+
9+
return \Symfony\CS\Config\Config::create()
10+
->setUsingCache(true)
11+
->fixers([
12+
'-concat_without_spaces',
13+
'concat_with_spaces',
14+
'ordered_use',
15+
])
16+
->finder($finder);

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ php:
55
- 5.4
66
- 5.5
77
- 5.6
8+
- hhvm
89

910
script: phpunit
1011

README.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Create a `composer.json` file in the root of your project:
4949
``` json
5050
{
5151
"require": {
52-
"jeremykendall/php-domain-parser": "~1.3"
52+
"jeremykendall/php-domain-parser": "~2.0"
5353
}
5454
}
5555
```
@@ -136,8 +136,12 @@ $publicSuffix = $url->host->publicSuffix;
136136
support was added in version `1.4.0`. Both unicode domains and their ASCII equivalents
137137
are supported.
138138

139-
**IMPORTANT**: PHP's [intl](http://php.net/manual/en/book.intl.php) extension is
139+
**IMPORTANT**:
140+
141+
* PHP's [intl](http://php.net/manual/en/book.intl.php) extension is
140142
required for the [IDN functions](http://php.net/manual/en/ref.intl.idn.php).
143+
* PHP's [mb_string](http://php.net/manual/en/book.mbstring.php) extension is
144+
required for [mb_strtolower](http://php.net/manual/en/function.mb-strtolower.php).
141145

142146
#### Unicode
143147

@@ -276,6 +280,24 @@ class Pdp\Uri\Url\Host#7 (3) {
276280
}
277281
```
278282

283+
### Validation of Public Suffixes
284+
285+
Public Suffix validation is available by calling `Parser::isValidSuffix()`:
286+
287+
```
288+
var_dump($parser->isValidSuffix('www.example.faketld');
289+
// false
290+
291+
var_dump($parser->isValidSuffix('www.example.com.au');
292+
// true
293+
```
294+
295+
A suffix is considered invalid if it is not contained in the [Public Suffix List](http://publicsuffix.org/).
296+
297+
> Huge thanks to [@SmellyFish](https://github.com/SmellyFish) for submitting
298+
> [Add a way to validate TLDs](https://github.com/jeremykendall/php-domain-parser/pull/36)
299+
> to add public suffix validation to the project.
300+
279301
### Retrieving Domain Components Only ###
280302

281303
If you're only interested in a domain component, you can use the parser to

build.xml

+17-8
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,40 @@
33

44
<property file="build.properties" />
55

6+
<target name="clean" description="Clean build path">
7+
<delete dir="${project.basedir}/build" />
8+
<mkdir dir="${project.basedir}/build" />
9+
<mkdir dir="${project.basedir}/build/coverage" />
10+
<mkdir dir="${project.basedir}/build/docs" />
11+
</target>
12+
613
<target name="phpunit" description="Running unit tests">
714
<exec
815
passthru="${passthru}"
916
dir="${project.basedir}"
10-
command="phpunit" />
17+
command="phpunit" />
1118
</target>
1219

1320
<target name="php-cs-fixer" description="PHP Codings Standards fixer">
1421
<exec
1522
passthru="${passthru}"
16-
command="php-cs-fixer --verbose fix library/" />
23+
command="php-cs-fixer --verbose fix" />
1724
</target>
1825

1926
<target name="phpdoc" description="Generate API documentation">
2027
<exec
2128
passthru="${passthru}"
2229
command="phpdoc
23-
-d ${project.basedir}/library
24-
-t ${project.basedir}/docs
25-
--title='PHP Domain Parser'
26-
--defaultpackagename='Pdp'
27-
--force" />
30+
-d ${project.basedir}/src
31+
-t ${project.basedir}/build/docs
32+
--title='PHP Domain Parser'
33+
--defaultpackagename='Pdp'
34+
--template='responsive-twig'
35+
--force" />
2836
</target>
29-
37+
3038
<target name="build" description="Build app">
39+
<phingCall target="clean" />
3140
<phingCall target="php-cs-fixer" />
3241
<phingCall target="phpunit" />
3342
<phingCall target="phpdoc" />

composer.json

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
{
22
"name": "jeremykendall/php-domain-parser",
33
"description": "Public Suffix List based URL parsing implemented in PHP.",
4+
"homepage": "https://github.com/jeremykendall/php-domain-parser",
5+
"support": {
6+
"issues": "https://github.com/jeremykendall/php-domain-parser/issues",
7+
"source": "https://github.com/jeremykendall/php-domain-parser"
8+
},
49
"license": "MIT",
510
"authors": [
611
{
712
"name": "Jeremy Kendall",
813
"homepage": "http://about.me/jeremykendall",
914
"role": "Developer"
15+
},
16+
{
17+
"name": "Contributors",
18+
"homepage": "https://github.com/jeremykendall/php-domain-parser/graphs/contributors"
1019
}
1120
],
1221
"bin": [
@@ -25,15 +34,15 @@
2534
"ext-mbstring": "*"
2635
},
2736
"require-dev": {
28-
"mikey179/vfsStream": "1.2.*",
29-
"phpunit/phpunit": "4.*"
37+
"mikey179/vfsStream": "~1.4",
38+
"phpunit/phpunit": "~4.4"
3039
},
3140
"autoload": {
3241
"psr-0": {
33-
"Pdp\\": "library/"
42+
"Pdp\\": "src/"
3443
},
3544
"files": [
36-
"library/mb-parse-url.php"
45+
"src/pdp-parse-url.php"
3746
]
3847
}
3948
}

0 commit comments

Comments
 (0)