From f2bceb755f1108758cf4cf925e4cd7699ce686aa Mon Sep 17 00:00:00 2001 From: Ignace Nyamagana Butera Date: Wed, 14 Mar 2018 18:19:39 +0100 Subject: [PATCH] prepare 5.3.0 release --- CHANGELOG.md | 24 ++++++ composer.json | 10 +-- docs/5.0/components/host.md | 126 +++++++++++++++++++--------- docs/5.0/components/installation.md | 1 - docs/5.0/parser/installation.md | 3 +- docs/5.0/uri/installation.md | 4 +- docs/_data/project.yml | 2 +- 7 files changed, 119 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbda9fba..44097d0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,30 @@ All Notable changes to `League\Uri` will be documented in this file +## 5.3.0 - 2018-03-14 + +See packages release notes for more informations + +- [URI Parser](https://github.com/thephpleague/uri-parser/releases/tag/1.4.0) +- [URI Components](https://github.com/thephpleague/uri-components/releases/tag/1.8.0) +- [URI Hostname Parser](https://github.com/thephpleague/uri-hostname-parser/releases/tag/1.1.0) +- [URI Manipulations](https://github.com/thephpleague/uri-manipulations/releases/tag/1.5.0) +- [URI Schemes](https://github.com/thephpleague/uri-schemes/releases/tag/1.2.0) + +### Added + +- IPvFuture support + +### Fixed + +- Adding PHPStan +- Improve RFC3986 compliance +- Improve performance + +### Remove + +- remove `mbstring` extension requirement + ## 5.2.0 - 2017-12-01 - [URI Parser](https://github.com/thephpleague/uri-parser/releases/tag/1.3.0) diff --git a/composer.json b/composer.json index ad93c449..228e2652 100644 --- a/composer.json +++ b/composer.json @@ -38,12 +38,12 @@ "ext-mbstring" : "*", "ext-intl" : "*", "ext-fileinfo": "*", - "league/uri-components": "^1.5.0", - "league/uri-hostname-parser": "^1.0.4", + "league/uri-components": "^1.8", + "league/uri-hostname-parser": "^1.1", "league/uri-interfaces": "^1.0", - "league/uri-manipulations": "^1.3", - "league/uri-parser": "^1.3.0", - "league/uri-schemes": "^1.1.1", + "league/uri-manipulations": "^1.5", + "league/uri-parser": "^1.4", + "league/uri-schemes": "^1.2", "php" : ">=7.0.13", "psr/http-message": "^1.0" }, diff --git a/docs/5.0/components/host.md b/docs/5.0/components/host.md index eafbbcae..b14e171b 100644 --- a/docs/5.0/components/host.md +++ b/docs/5.0/components/host.md @@ -26,6 +26,7 @@ class Host implements ComponentInterface, Countable, IteratorAggregate public function __construct(?string $content = null, Rules $resolver = null): void public function append(string $host): self public function getIp(void): string + public function getIpVersion(void): string|null public function getLabel(int $offset, $default = null): mixed public function getLabels(void): array public function getPublicSuffix(void): string @@ -35,6 +36,8 @@ class Host implements ComponentInterface, Countable, IteratorAggregate public function isIp(void): bool public function isIpv4(void): bool public function isIpv6(void): bool + public function isIpFuture(void): bool + public function isDomain(void): bool public function isPublicSuffixValid(void): bool public function isAbsolute(void): bool public function keys([string $label]): array @@ -72,11 +75,13 @@ The `League\Uri\Components\Exception` extends PHP's SPL `InvalidArgumentExceptio withContent('127.0.0.1'); $ip_host->isIp(); //return true; ~~~ -Knowing that you are dealing with an IP is good, knowing that its an IPv4 or an IPv6 is better. +Knowing that you are dealing with an IP is good, knowing its version is better. ~~~php isIp(); //return true -$ipv6->isIpv4(); //return false -$ipv6->isIpv6(); //return true +$ipv6->isIp(); //return true +$ipv6->isIpv4(); //return false +$ipv6->isIpv6(); //return true +$ipv6->isIpFuture(); //return false +$ipv6->getIpVersion(); //return '6' $ipv4 = new Host('127.0.0.1'); -$ipv4->isIp(); //return true -$ipv4->isIpv4(); //return true -$ipv4->isIpv6(); //return false +$ipv4->isIp(); //return true +$ipv4->isIpv4(); //return true +$ipv4->isIpv6(); //return false +$ipv4->isIpFuture(); //return false +$ipv4->getIpVersion(); //return '4' + +$ipfuture = new Host('v32.1.2.3.4'); +$ipfuture->isIp(); //return true +$ipfuture->isIpv4(); //return false +$ipfuture->isIpv6(); //return false +$ipfuture->isIpFuture(); //return true +$ipfuture->getIpVersion(); //return '32' + +$domain = new Host('thephpleague.com'): +$domain->isIp(); //return false +$domain->isIpv4(); //return false +$domain->isIpv6(); //return false +$domain->isIpFuture(); //return false +$domain->getIpVersion(); //return null ~~~ ### Zone Identifier @@ -188,19 +211,60 @@ $host = new Host('[fe80::1%25eth0-1]'); $host->getIp(); //returns 'fe80::1%eth0-1' $newHost = $host->withContent('uri.thephpleague.com'); -$newHost->getIp(); //returns null +$newHost->getIp(); //returns null +$newHost->getIpVersion(); //returns null ~~~ -## Host represented by a domain name - -

Host::getRegisterableDomain and Host::withRegisterableDomain are deprecated and replaced by Host::getRegistrableDomain and Host::withRegistrableDomain starting with version 1.5.0.

+## Host represented by a registered name If you don't have a IP then you are dealing with a registered name. A registered name can be a [domain name](http://tools.ietf.org/html/rfc1034) subset if it follows [RFC1123](http://tools.ietf.org/html/rfc1123#section-2.1) but it is not a requirement as stated in [RFC3986](https://tools.ietf.org/html/rfc3986#section-3.2.2) > (...) URI producers should use names that conform to the DNS syntax, even when use of DNS is not immediately apparent, and should limit these names to no more than 255 characters in length. +

Host::isDomain is available since version 1.8.0.

+ ~~~php isDomain(); //return true + +$reg_name = new Host('...test.com'); +$reg_name->isDomain(); //return false +~~~ + +## Host represented by a domain name + +

Host::getRegisterableDomain and Host::withRegisterableDomain are deprecated and replaced by Host::getRegistrableDomain and Host::withRegistrableDomain starting with version 1.5.0.

+ +If you don't have an IP or a general registered name it means you are using a domain name. As such the following method can be used to further caracterize your host. + +~~~php +getPublicSuffix(); //display 'co.uk' -echo $host->getRegistrableDomain(); //display 'example.co.uk' -echo $host->getSubDomain(); //display 'www' -$host->isPublicSuffixValid(); //return a boolean 'true' in this example +echo $host->getPublicSuffix(); //display 'co.uk' +echo $host->getRegistrableDomain(); //display 'example.co.uk' +echo $host->getSubDomain(); //display 'www' +$host->isPublicSuffixValid(); //return a boolean 'true' in this example ~~~ If the data is not found the methods listed above will all return an **empty string** except for the `Host::isPublicSuffixValid` method which will return `false`. @@ -238,10 +302,10 @@ If the data is not found the methods listed above will all return an **empty str use League\Uri\Components\Host; $host = new Host('192.158.26.30'); -echo $host->getPublicSuffix(); //return '' -echo $host->getRegistrableDomain(); //return '' -echo $host->getSubDomain(); //return '' -$host->isPublicSuffixValid(); //return false +echo $host->getPublicSuffix(); //return '' +echo $host->getRegistrableDomain(); //return '' +echo $host->getSubDomain(); //return '' +$host->isPublicSuffixValid(); //return false ~~~ ### Updating the Registrable domain part @@ -276,26 +340,6 @@ echo $newHost; //displays 'shop.11.be'

This method throws an League\Uri\Components\Exception if you submit a FQDN.

-## Host as a general registered name - -~~~php -= 7.0** but the latest stable version of PHP is recommended -- the `mbstring` extension - the `intl` extension Installation diff --git a/docs/5.0/parser/installation.md b/docs/5.0/parser/installation.md index 97a64166..4cf23524 100644 --- a/docs/5.0/parser/installation.md +++ b/docs/5.0/parser/installation.md @@ -12,7 +12,8 @@ System Requirements You need: - **PHP >= 7.0** but the latest stable version of PHP is recommended -- the `intl` extension + +While the library no longer requires out of the box the `intl` extension starting with version `1.4.0` to work, you still require it if you are dealing with URIs containing non-ASCII host. Without it, the parser will throw an exception if such URI is parsed. Installation -------- diff --git a/docs/5.0/uri/installation.md b/docs/5.0/uri/installation.md index 0477818e..95b93350 100644 --- a/docs/5.0/uri/installation.md +++ b/docs/5.0/uri/installation.md @@ -12,8 +12,8 @@ System Requirements You need: - **PHP >= 7.0.13** but the latest stable version of PHP is recommended -- the `mbstring` extension -- the `intl` extension + +While the library no longer requires out of the box the `intl` extension starting with version `1.2.0`, you should still require it if you are dealing with URIs containing non-ASCII host. Without it, URI creation or manipulation action will throw an exception if such hosts are used. Installation -------- diff --git a/docs/_data/project.yml b/docs/_data/project.yml index 2a7b896c..004c5cdf 100644 --- a/docs/_data/project.yml +++ b/docs/_data/project.yml @@ -9,7 +9,7 @@ releases: current: version: '5.0' requires: 'PHP >= 7.0.0' - latest: '5.2.0 - 2017-12-01' + latest: '5.3.0 - 2018-03-14' supported_until: 'TBD' documentation_link: '/5.0/' legacy: