src/Request/Http/HttpRequest.php
public static function replaceQueryParamsInUrl(array $queryParams, $url)
    {
        if (empty($queryParams)) {
            return $url;
        }
        $parsedUrl = self::parseUrl($url);
        $queryString = isset($parsedUrl['query']) ? $parsedUrl['query'] : '';
        foreach ($queryParams as $param => $value) {
            $queryString = self::replaceQueryParam($param, $value, $queryString);
        }
        $parsedUrl['query'] = $queryString;
        return self::buildUrl($parsedUrl);
    }
public static function replaceQueryParamsInUrl(array $queryParams, $url)
    {
        if (empty($queryParams)) {
            return $url;
        }
        $parsedUrl = self::parseUrl($url);
        $queryString = isset($parsedUrl['query']) ? $parsedUrl['query'] : '';
        foreach ($queryParams as $param => $value) {
            $queryString = self::replaceQueryParam($param, $value, $queryString);
        }
        $parsedUrl['query'] = $queryString;
        return self::buildUrl($parsedUrl);
    }
public static function replaceQueryParamsInUrl ( array $ queryParams , $ url ) { if ( empty ( $ queryParams ) ) { return $ url ; } $ parsedUrl = self :: parseUrl ( $ url ) ; $ queryString = isset ( $ parsedUrl [ 'query' ] ) ? $ parsedUrl [ 'query' ] : '' ; foreach ( $ queryParams as $ param => $ value ) { $ queryString = self :: replaceQueryParam ( $ param , $ value , $ queryString ) ; } $ parsedUrl [ 'query' ] = $ queryString ; return self :: buildUrl ( $ parsedUrl ) ; }
Replaces or adds a query parameters to a url.

@param array $queryParams the query params to replace.
@param string $url the url.
@return string the updated url.
Replaces or adds a query parameters to a url .