src/Util/Http.php
public static function buildQueryString(array $parameters) : string
    {
        $queryStrings = [];
        foreach ($parameters as $parameterName => $parameterValue) {
            $parameterName = rawurlencode($parameterName);

            if (is_array($parameterValue)) {
                foreach ($parameterValue as $eachValue) {
                    $eachValue = rawurlencode($eachValue);
                    $queryStrings[] = "{$parameterName}={$eachValue}";
                }
            } elseif ($parameterValue === false) {
                $queryStrings[] = "{$parameterName}=false";
            } elseif ($parameterValue === true) {
                $queryStrings[] = "{$parameterName}=true";
            } else {
                $parameterValue = rawurlencode($parameterValue);
                $queryStrings[] = "{$parameterName}={$parameterValue}";
            }
        }

        return implode('&', $queryStrings);
    }
public static function buildQueryString(array $parameters) : string
    {
        $queryStrings = [];
        foreach ($parameters as $parameterName => $parameterValue) {
            $parameterName = rawurlencode($parameterName);

            if (is_array($parameterValue)) {
                foreach ($parameterValue as $eachValue) {
                    $eachValue = rawurlencode($eachValue);
                    $queryStrings[] = "{$parameterName}={$eachValue}";
                }
            } elseif ($parameterValue === false) {
                $queryStrings[] = "{$parameterName}=false";
            } elseif ($parameterValue === true) {
                $queryStrings[] = "{$parameterName}=true";
            } else {
                $parameterValue = rawurlencode($parameterValue);
                $queryStrings[] = "{$parameterName}={$parameterValue}";
            }
        }

        return implode('&', $queryStrings);
    }
public static function buildQueryString ( array $ parameters ) : string { $ queryStrings = [ ] ; foreach ( $ parameters as $ parameterName => $ parameterValue ) { $ parameterName = rawurlencode ( $ parameterName ) ; if ( is_array ( $ parameterValue ) ) { foreach ( $ parameterValue as $ eachValue ) { $ eachValue = rawurlencode ( $ eachValue ) ; $ queryStrings [ ] = "{$parameterName}={$eachValue}" ; } } elseif ( $ parameterValue === false ) { $ queryStrings [ ] = "{$parameterName}=false" ; } elseif ( $ parameterValue === true ) { $ queryStrings [ ] = "{$parameterName}=true" ; } else { $ parameterValue = rawurlencode ( $ parameterValue ) ; $ queryStrings [ ] = "{$parameterName}={$parameterValue}" ; } } return implode ( '&' , $ queryStrings ) ; }
Generate URL-encoded query string

Example:
<code>
$parameters = [
'param1' => ['value', 'another value'],
'param2' => 'a value',
'param3' => false,
];

$queryString = \TraderInteractive\HttpUtil::buildQueryString($parameters);

echo $queryString
</code>

Output:
<pre>
param1=value&param1=another+value&param2=a+value&param3=false
</pre>

@param array $parameters An associative array containing parameter key/value(s)

@return string the built query string
Generate URL - encoded query string