UriResolver
in package
The UriResolver class takes an URI (relative, absolute, fragment, etc.) and turns it into an absolute URI against another given base URI.
Tags
Table of Contents
- resolve() : string
- Resolves a URI according to a base URI.
- canonicalizePath() : string
- Returns the canonicalized URI path (see RFC 3986, section 5.2.4).
- cleanupAnchor() : string
- Removes the anchor from the uri.
- cleanupQuery() : string
- Removes the query string from the uri.
- cleanupUri() : string
- Removes the query string and the anchor from the given uri.
Methods
resolve()
Resolves a URI according to a base URI.
public
static resolve(string $uri, string|null $baseUri) : string
For example if $uri=/foo/bar and $baseUri=https://symfony.com it will return https://symfony.com/foo/bar
If the $uri is not absolute you must pass an absolute $baseUri
Parameters
- $uri : string
- $baseUri : string|null
Return values
string —canonicalizePath()
Returns the canonicalized URI path (see RFC 3986, section 5.2.4).
private
static canonicalizePath(string $path) : string
Parameters
- $path : string
Return values
string —cleanupAnchor()
Removes the anchor from the uri.
private
static cleanupAnchor(string $uri) : string
Parameters
- $uri : string
Return values
string —cleanupQuery()
Removes the query string from the uri.
private
static cleanupQuery(string $uri) : string
Parameters
- $uri : string
Return values
string —cleanupUri()
Removes the query string and the anchor from the given uri.
private
static cleanupUri(string $uri) : string
Parameters
- $uri : string