Skip to content

Releases: wasinger/url

Version 0.7.1

25 Jul 16:02
Compare
Choose a tag to compare

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 implements UriInterface
  • methods for converting between Url and Psr7Uri

Class Url does not implement the PSR Interface by itself for two reasons:

  1. To not introduce a new dependency on the PSR interface. The dependency is only "suggested" in composer json.
  2. Because the PSR interface is designed to be immutable,
    while Url 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

08 Mar 19:57
Compare
Choose a tag to compare

Unit tests compatible with newer phpunit versions

Version 0.6.1

08 Mar 16:23
Compare
Choose a tag to compare

Fix PHPUnit tests

Version 0.6.0

08 Mar 09:47
Compare
Choose a tag to compare

Method makeAbsolute now converts also host-relative or scheme-relative to absolute URLs