Class UrlUtil
Utility class for URL manipulation.
Methods summary
public static
parseQueryString( string|null|string[] $queryString
)
: string[]
Parses a query string into an associative array.
Parses a query string into an associative array.
PHP syntax and duplicated arguments are not supported (foo[bar]=
, foo[]=
, etc.).
Parameters
Returns
string[]
String parameter values by parameter name.
Throws
InvalidArgumentException
public static
replaceQueryStringInUrl( string $url
, string|array $newQueryString
)
: string
Returns a new URL with the desired query string in lieu of the original one, if any.
Returns a new URL with the desired query string in lieu of the original one, if any.
Parameters
$url
- The original URL to replace the query string from.
$newQueryString
- The new query string to use.
Returns
string
The modified URL with a new query string.