28

How can I get the base url or home url of the Laravel application ?

I have seen similar question. And all of them are based on laravel 4. I have tried the suggesting answer But none of these work in laravel 5. So please consider this things before vote down or treat this as a duplicate.

Ahmad Sharif
  • 4,141
  • 5
  • 37
  • 49

1 Answers1

67

You can get the base url of the Laravel application by:

echo url('/');

or

{{ url('/') }}

Read more about Laravel helpers here

Oscar Gallardo
  • 2,240
  • 3
  • 27
  • 47
Sulthan Allaudeen
  • 11,330
  • 12
  • 48
  • 63
  • 13
    On Laravel 5.2 later, you can't use just url(). Instead, use url('/'). https://github.com/laravel/framework/pull/10934 – mul14 Nov 17 '15 at 10:54