Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Parse a URL and return its components
<?php parse_url(string $url, int $component = -1): int|string|array|null|false
<?php             ? sprintf('%s?token=%s', static::$url, $token)

            : $defaultUrl;



        parse_str(parse_url($url, PHP_URL_QUERY) ?: '', $query);



        if (static::$redirect) {

            $query = array_merge($query, ['redirect' => static::$redirect]);
<?php             return $url;

        }



        $url = parse_url($url);



        if ($query = array_get($url, 'query')) {

            $query .= '&';
<?php     protected function isLoginUrl()

    {

        return parse_url($this->url, PHP_URL_PATH) === parse_url($this->getLoginUrl(), PHP_URL_PATH);

    }



    protected function shouldAppendRedirect()
<?php     public function makeRelative($url)

    {

        $parsed = parse_url($url);



        $url = $parsed['path'] ?? '/';
<?php         $previous = session('_previous.url');



        if (! $query = array_get(parse_url($previous), 'query')) {

            return $default;

        }
<?php         $this->client = $client ?: new Client();

        $this->supportsHead = $supportsHead;



        if (isset(parse_url($base)['user'])) {

            $this->visibility = AdapterInterface::VISIBILITY_PRIVATE;

        }

    }
<?php         $this->skip_validation = true;

        $this->params = $params;



        $parsed = parse_url($url);



        $base = $parsed['scheme'].'://'.$parsed['host'];
<?php             $url = strtok($value, '#');




            $fragment = parse_url($value, PHP_URL_FRAGMENT);

            $anchor = is_null($fragment) ? '' : "#{$fragment}";
<?php             $url = strtok($url, '#');




            $parsedUrl = parse_url($value);




            $anchor = isset($parsedUrl['fragment']) ? "#{$parsedUrl['fragment']}" : '';
<?php             $segment = Arr::get($context, $segment);

        }



        $url = parse_url($value);
<?php             $url = strtok($url, '#');




            $parsedUrl = parse_url($value);




            $anchor = isset($parsedUrl['fragment']) ? "#{$parsedUrl['fragment']}" : '';
<?php     private function removePath($url)

    {

        $parsed = parse_url($url);



        return $parsed['scheme'].'://'.$parsed['host'];

    }
<?php     public function getFilePath($url)

    {

        $urlParts = parse_url($url);

        $pathParts = pathinfo($urlParts['path']);

        $slug = $pathParts['basename'];

        $query = $this->config('ignore_query_strings') ? '' : Arr::get($urlParts, 'query', '');