Search code examples
phplaravellaravel-5laravel-request

Laravel Request getting current path with query string


Is there a Laravel way to get the current path of a Request with its query parameters?

For instance, for the URL:

http://www.example.com/one/two?key=value

Request::getPathInfo() would return /one/two.

Request::url() would return http://www.example.com/one/two.

The desired output is /one/two?key=value.


Solution

  • Try to use the following:

    \Request::getRequestUri()