src/Panda/Support/Helpers/UrlHelper.php
public static function get($url, $parameters = [], $host = null, $protocol = null)
    {
        // Check url arguments
        if (empty($url)) {
            throw new InvalidArgumentException(__METHOD__ . ': The given url is empty.');
        }

        // Get current url info
        $urlInfo = static::info($url);
        $finalUrl = ArrayHelper::get($urlInfo, 'path.plain', '', true);

        // Build url query
        $urlParameters = ArrayHelper::get($urlInfo, 'path.parameters', [], true);
        $parameters = ArrayHelper::merge($parameters, $urlParameters);

        if (!empty($parameters)) {
            $finalUrl .= '?' . http_build_query($parameters);
        }

        // Set protocol
        $host = $host ?: $urlInfo['host'];
        $protocol = $protocol ?: $urlInfo['protocol'];

        // Resolve URL according to system configuration
        return (empty($host) ? '' : $protocol . '://') . static::normalize($host . '/' . $finalUrl);
    }
public static function get($url, $parameters = [], $host = null, $protocol = null)
    {
        // Check url arguments
        if (empty($url)) {
            throw new InvalidArgumentException(__METHOD__ . ': The given url is empty.');
        }

        // Get current url info
        $urlInfo = static::info($url);
        $finalUrl = ArrayHelper::get($urlInfo, 'path.plain', '', true);

        // Build url query
        $urlParameters = ArrayHelper::get($urlInfo, 'path.parameters', [], true);
        $parameters = ArrayHelper::merge($parameters, $urlParameters);

        if (!empty($parameters)) {
            $finalUrl .= '?' . http_build_query($parameters);
        }

        // Set protocol
        $host = $host ?: $urlInfo['host'];
        $protocol = $protocol ?: $urlInfo['protocol'];

        // Resolve URL according to system configuration
        return (empty($host) ? '' : $protocol . '://') . static::normalize($host . '/' . $finalUrl);
    }
public static function get ( $ url , $ parameters = [ ] , $ host = null , $ protocol = null ) { // Check url arguments if ( empty ( $ url ) ) { throw new InvalidArgumentException ( __METHOD__ . ': The given url is empty.' ) ; } // Get current url info $ urlInfo = static :: info ( $ url ) ; $ finalUrl = ArrayHelper :: get ( $ urlInfo , 'path.plain' , '' , true ) ; // Build url query $ urlParameters = ArrayHelper :: get ( $ urlInfo , 'path.parameters' , [ ] , true ) ; $ parameters = ArrayHelper :: merge ( $ parameters , $ urlParameters ) ; if ( ! empty ( $ parameters ) ) { $ finalUrl .= '?' . http_build_query ( $ parameters ) ; } // Set protocol $ host = $ host ? : $ urlInfo [ 'host' ] ; $ protocol = $ protocol ? : $ urlInfo [ 'protocol' ] ; // Resolve URL according to system configuration return ( empty ( $ host ) ? '' : $ protocol . '://' ) . static :: normalize ( $ host . '/' . $ finalUrl ) ; }
Creates and returns a url with parameters in url encoding.

@param string $url        The base url.
@param array  $parameters An associative array of parameters as key => value.
@param string $host
@param string $protocol

@return string
@throws InvalidArgumentException
Creates and returns a url with parameters in url encoding .