Releases: wasinger/url
Releases · wasinger/url
Version 0.7.1
Compatibility with Psr\Http\Message\UriInterface
(PSR-7)
- class
Url
now has all methods defined in this interface but does not officially implement it. - new wrapper class
Psr7Uri
that implementsUriInterface
- methods for converting between
Url
andPsr7Uri
Class Url
does not implement the PSR Interface by itself for two reasons:
- To not introduce a new dependency on the PSR interface. The dependency is only "suggested" in composer json.
- Because the PSR interface is designed to be immutable,
whileUrl
is not.
To use this feature, you need to composer require psr/http-message
<?php
use Wa72\Url\Psr7Uri;
use Wa72\Url\Url;
# Get a Psr7Uri from a Url object
$url = Url::parse('https://www.foo.bar/test.php?a=b');
$psr7uri = Psr7Uri::fromUrl($url);
// or alternatively:
$psr7uri = $url->toPsr7();
# Get a Url object from UriInterface
$url = Url::fromPsr7($psr7uri);
// or alternatively:
$url = $psr7uri->toUrl();
Version 0.6.2
Unit tests compatible with newer phpunit versions
Version 0.6.1
Fix PHPUnit tests
Version 0.6.0
Method makeAbsolute now converts also host-relative or scheme-relative to absolute URLs