Contao Utils Bundle

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
string

makeUrlRelative()

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
throws
InvalidUrlException
Return values
string

removeQueryStringParameterFromUrl()

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
string

removeQueryStringParameterToUrl()

public removeQueryStringParameterToUrl(string $parameter[, string $url = '' ]) : string

Use removeQueryStringParameterFromUrl() instead

Parameters
$parameter : string
$url : string = ''
Tags
codeCoverageIgnore
Return values
string

buildUrlString()

private buildUrlString(array<string|int, mixed> $parsedUrl) : string
Parameters
$parsedUrl : array<string|int, mixed>
Return values
string

        
On this page

Search results