Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Url.toAbsolute

toAbsolute($newOrigin='') -> Url

Description

Returns a URL of the current object with the given $newOrigin (host/domain).

If $newOrigin is empty, the origin of the hosting site will be used.

// on 'mysite.com'
$relUrl = url'/my/page?foo=1'

$relUrl.toAbsolute()
//= url'https://mysite.com/my/page?foo=1'


// With an explicit origin
$relUrl = url'/my/page?foo=1'

$relUrl.toAbsolute('https://mysite.com')
//= url'https://mysite.com/my/page?foo=1'

See Also