Retrieve the REQUEST_URI without and GET parameters

@example /contact-us
@return string
438653
public function getRequestUri()
    {
        if (isset($this->env['REQUEST_URI'])) {
            $uri = $this->env['REQUEST_URI'];
        } else {
            $uri = "/";
        }
        if (strstr($uri, "?")) {
            $uri = strstr($uri, "?", true);
        }
        return $uri;
    }
341986
public static function get_request_document() {
        $uri = $_SERVER['REQUEST_URI'];     // /tsugi/lti/some/cool/stuff
        $pieces = explode('/',$uri);
        if ( count($pieces) > 1 ) {
            $local_path = $pieces[count($pieces)-1];
            $pos = strpos($local_path,'?');
            if ( $pos > 0 ) $local_path = substr($local_path,0,$pos);
            return $local_path;
        }
        return false;
    }
1217473
public static function getUrl()
    {
        if (static::isCLI()) {
            return null;
        }

        if (static::$url === null) {
            $url = 'http';
            if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
                $url .= 's';
            }
            $url .= '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
            static::$url = new Url($url);
        }

        return static::$url;
    }
631558
private function getActionParams()
    {
        $result = '';
        $requestParams = Yii::$app->request->getParams();
        ArrayHelper::remove($requestParams, 0);

        foreach ($requestParams as $key => $value) {
            if (is_string($key)) {
                $result .= " --{$key}={$value}";
            } else {
                $result .= " {$value}";
            }
        }

        return $result;
    }
16451
public function base_uri(){
    	$uri = $this->uri();
		if (($strpos = strpos($uri, '?')) !== false) 
			$uri = substr($uri, 0, $strpos);
		return $uri;
    }
694001
private function getURI()
    {
        if (!empty($_SERVER['PATH_INFO'])) {
            $uri = $_SERVER['PATH_INFO'];
        } elseif (!empty($_SERVER['REQUEST_URI'])) {
            $uri = $_SERVER['REQUEST_URI'];
        } else {
            $uri = false;
        }

        if ($uri === '/') {
            $uri = false;
        }

        return trim(preg_replace('/\?.*/', '', $uri), '/');
    }
407557
public function getUri()
    {
        if ( $this->hasChildren() )
        {
            foreach( $this->getChildren() as $child )
            {
                $uri = $child->getUri();

                if ( '#' != $uri[0] )
                {
                    return $uri;
                }
            }
        }
        else
        {
            return '#';
        }
    }
1116201
public function getRequestUri($includeParameters = false)
    {
        $uri = $this->uri;

        if (!$includeParameters) {
            $sepIdx = strpos($uri, '?');

            if ($sepIdx !== false) {
                $uri = substr($uri, 0, $sepIdx);
            }
        }

        return $uri;
    }
384195
public static function getRequestUriParts() {
    $requestUri = self::get(self::REQUEST_URI);
    $requestUri = mb_split('\?', $requestUri)[0];
    $parts = mb_split('\/', $requestUri);
    if (count($parts) > 1 && $parts[0] === '') {
      $parts = array_slice($parts, 1);
    }
    if (count($parts) > 1 && $parts[count($parts) - 1] === '') {
      $parts = array_slice($parts, 0, count($parts) - 1);
    }
    return $parts;
  }
1325590
public function getApiRequest()
    {
        if (empty($_SERVER['REQUEST_URI'])) {
            return "";
        }
        
        $api_request = $_SERVER['REQUEST_URI'];
        
        if (!empty($_SERVER['QUERY_STRING'])) {
            $api_request = str_replace($_SERVER['QUERY_STRING'], "", $api_request);
        }
        
        $api_request = rtrim($api_request, "/?");
        
        $api_base = str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
        
        $api_base = rtrim($api_base, "/");
        
        //echo $api_request . "<br>";
        //echo $api_base . "<br>";
        
        return trim(str_replace($api_base, "", $api_request), "/");
    }
8878
public function getUri()
    {
        if (null !== $qs = $this->getQueryString()) {
            $qs = '?' . $qs;
        }
        return $this->getSchemeAndHttpHost() . $this->getBaseUrl() . $this->getRequest()->getPathInfo() . $qs;
    }
33558
public static function uri()
	{
		if (static::$detected_uri !== null)
		{
			return static::$detected_uri;
		}

		if (\Fuel::$is_cli)
		{
			if ($uri = \Cli::option('uri') !== null)
			{
				static::$detected_uri = $uri;
			}
			else
			{
				static::$detected_uri = \Cli::option(1);
			}

			return static::$detected_uri;
		}

		// We want to use PATH_INFO if we can.
		if ( ! empty($_SERVER['PATH_INFO']))
		{
			$uri = $_SERVER['PATH_INFO'];
		}
		// Only use ORIG_PATH_INFO if it contains the path
		elseif ( ! empty($_SERVER['ORIG_PATH_INFO']) and ($path = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['ORIG_PATH_INFO'])) != '')
		{
			$uri = $path;
		}
		else
		{
			// Fall back to parsing the REQUEST URI
			if (isset($_SERVER['REQUEST_URI']))
			{
				$uri = strpos($_SERVER['SCRIPT_NAME'], $_SERVER['REQUEST_URI']) !== 0 ? $_SERVER['REQUEST_URI'] : '';
			}
			else
			{
				throw new \FuelException('Unable to detect the URI.');
			}

			// Remove the base URL from the URI
			$base_url = parse_url(\Config::get('base_url'), PHP_URL_PATH);
			if ($uri != '' and strncmp($uri, $base_url, strlen($base_url)) === 0)
			{
				$uri = substr($uri, strlen($base_url) - 1);
			}

			// If we are using an index file (not mod_rewrite) then remove it
			$index_file = \Config::get('index_file');
			if ($index_file and strncmp($uri, $index_file, strlen($index_file)) === 0)
			{
				$uri = substr($uri, strlen($index_file));
			}

			// When index.php? is used and the config is set wrong, lets just
			// be nice and help them out.
			if ($index_file and strncmp($uri, '?/', 2) === 0)
			{
				$uri = substr($uri, 1);
			}

			// decode the uri, and put any + back (does not mean a space in the url path)
			$uri = str_replace("\r", '+', urldecode(str_replace('+', "\r", $uri)));

			// Lets split the URI up in case it contains a ?.  This would
			// indicate the server requires 'index.php?' and that mod_rewrite
			// is not being used.
			preg_match('#(.*?)\?(.*)#i', $uri, $matches);

			// If there are matches then lets set set everything correctly
			if ( ! empty($matches))
			{
				$uri = $matches[1];

				// only reconstruct $_GET if we didn't have a query string
				if (empty($_SERVER['QUERY_STRING']))
				{
					$_SERVER['QUERY_STRING'] = $matches[2];
					parse_str($matches[2], $_GET);
					$_GET = \Security::clean($_GET);
				}
			}
		}

		// Deal with any trailing dots
		$uri = rtrim($uri, '.');

		// Do we have a URI and does it not end on a slash?
		if ($uri and substr($uri, -1) !== '/')
		{
			// Strip the defined url suffix from the uri if needed
			$ext = strrchr($uri, '.');
			$path = $ext === false ? $uri : substr($uri, 0, -strlen($ext));

			// Did we detect something that looks like an extension?
			if ( ! empty($ext))
			{
				// if it has a slash in it, it's a URI segment with a dot in it
				if (strpos($ext,'/') === false)
				{
					static::$detected_ext = ltrim($ext, '.');

					if (\Config::get('routing.strip_extension', true))
					{
						$uri = $path;
					}
				}
			}
		}

		// Do some final clean up of the uri
		static::$detected_uri = \Security::clean_uri($uri, true);

		return static::$detected_uri;
	}
1328338
public function getAppUri()
    {
        $uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
        $scriptPath = $this->getBaseUrl();
        $appUri = substr($uri, strlen($scriptPath));
        return $appUri === false ? '' : $appUri;
    }
947314
public function getUri()
    {
        if (!$this->uri)
            $this->uri = new Uri($this->httpMessage->getTarget());
        
        return $this->uri;
    }
478638
public function getRequestUri()
    {
        if ($this->requestUri === null) {
            $this->requestUri = $this->getServer('REQUEST_URI');
        }
        return $this->requestUri;
    }
653109
public function getUri(): string
    {
        foreach ($this->getParameterArray() as $parameter) {
            if (property_exists($this, $parameter)) {
                if (isset($this->$parameter)) {
                    $this->uri = str_replace('{' . $parameter . '}', $this->$parameter, $this->uri);
                } else {
                    $this->uri = str_replace('&'. $parameter . '={' . $parameter . '}', '', $this->uri);
                }
            }
        }
        foreach ($this->extraParameters as $parameter => $function) {
            $this->uri = str_replace('{' . $parameter . '}', $this->$function(), $this->uri);
        }
        return $this->uri;
    }
71022
public function getUri()
    {
        $userPart = '';
        if ($this->getUser() !== null && $this->getPass() !== null) {
            $userPart = $this->getUser() . ':' . $this->getPass()  . '@';
        } else if ($this->getUser() !== null) {
            $userPart = $this->getUser() . '@';
        }
        $schemePart = ($this->getScheme() ? $this->getScheme() . '://' : '//');
        if (!in_array($this->getScheme(), self::getSchemesWithAuthority())) {
            $schemePart = $this->getScheme() . ':';
        }
        $portPart = ($this->getPort() ? ':' . $this->getPort() : '');
        $queryPart = ($this->getQuery() ? '?' . $this->getQuery() : '');
        $fragmentPart = ($this->getFragment() ? '#' . $this->getFragment() : '');
        if ($this->isRelative()) {
            return $this->getPath() .
            $queryPart .
            $fragmentPart;
        }
        $path = $this->getPath();
        if (0 !== strlen($path) && '/' !== $path[0]) {
            $path = '/' . $path;
        }
        return $schemePart .
        $userPart .
        $this->getHost() .
        $portPart .
        $path .
        $queryPart .
        $fragmentPart;
    }