UrlUtil
in package
Table of Contents
Properties
- $requestStack : RequestStack
Methods
- __construct() : mixed
- addQueryStringParameterToUrl() : string
- Add a query string parameter to an url.
- makeUrlRelative() : string
- Convert an absolute url to a relative url.
- removeQueryStringParameterFromUrl() : string
- Remove a query parameter (GET parameter) from an url.
- removeQueryStringParameterToUrl() : string
- buildUrlString() : string
Properties
$requestStack
private
RequestStack
$requestStack
Methods
__construct()
public
__construct(RequestStack $requestStack) : mixed
Parameters
- $requestStack : RequestStack
addQueryStringParameterToUrl()
Add a query string parameter to an url.
public
addQueryStringParameterToUrl(string $parameter[, string $url = '' ]) : string
If no url is given, the current request url is used.
Parameters
- $parameter : string
- $url : string = ''
Return values
stringmakeUrlRelative()
Convert an absolute url to a relative url.
public
makeUrlRelative(string $url[, array<string|int, mixed> $options = [] ]) : string
Options:
- removeLeadingSlash: (boolean) Remove leading slash from path
Parameters
- $url : string
-
The url that should be made relative
- $options : array<string|int, mixed> = []
-
Pass additional options
Tags
Return values
stringremoveQueryStringParameterFromUrl()
Remove a query parameter (GET parameter) from an url.
public
removeQueryStringParameterFromUrl(string $parameter[, string $url = '' ]) : string
If no url is given, the method tries to get the current url from the request.
Parameters
- $parameter : string
-
The query parameter name to remove
- $url : string = ''
-
the url where the query parameter should be removed
Return values
stringremoveQueryStringParameterToUrl()
public
removeQueryStringParameterToUrl(string $parameter[, string $url = '' ]) : string
Use removeQueryStringParameterFromUrl() instead
Parameters
- $parameter : string
- $url : string = ''
Tags
Return values
stringbuildUrlString()
private
buildUrlString(array<string|int, mixed> $parsedUrl) : string
Parameters
- $parsedUrl : array<string|int, mixed>