How to Get Current URL with Parameters in Laravel?

Today now in this post i will show you How to Get Current URL with Parameters in Laravel? sometimes we may need to get the full url path also with query string parameters on that way we can easily perform on it. So we can get the current url with also all the parameter by using several method of laravel 6, laravel 7 and laravel 8 any version.

There are the several option to get the full url with query string as listed in bellow:

  • URL Facade
  • Request Facade
  • $request Object

I will give you here three way to get the full path with parameters, so we can see as bellow:

Example 1:
public function index()
{
    $fullURL = \URL::full();
    print_r($fullURL);
}
Example 2:
public function index()
{
    $fullURL = \Request::fullUrl();
    print_r($fullURL);
}
Example 3:
public function index(Request $request)
{
    $fullURL = $request->fullUrl();
    print_r($fullURL);
}

Read Also : Laravel 8 Mobile Number Verification Tutorial

Thanks for read. I hope it help you. For more you can follow us on facebook

Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.