Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

RuinSain's avatar

Difference between 'use Request' and 'use Illuminate\Http\Request'?

Hi, all. recently i wanted to add the option to search my blog, and it came up that i needed to change to 'use Request' instead of 'use Illuminate\Http\Request'. what is the Difference between them?

0 likes
4 replies
WebKenth's avatar

Check in your config/app.php you will find that Request is an alias for Illuminate\Support\Facades\Request::class

1 like
katifrantz's avatar

Techinically speaking , there is no difference. use Request is a declaration of the Facade registered in the config/app.php aliases array . This class found in Illuminate\Support\Facades\Request::class is the facade accessor for Illuminate\Http\Request class. So using either should be exactly the same result .

1 like
RuinSain's avatar

Oh, but here is another newbie question, is there a difference between 'Illuminate\Support\Facades\Request::class' and 'use Illuminate\Http\Request'?

edit: @maitrefrantz When i used Illuminate\Http\Request, i was given an error of "method links does not exist" for some reason. but when i used 'use Request', i did not ended up with this error. how is this possible if they are all the same?

katifrantz's avatar

But i just said yes , they are two different classes, but one is a class that serves as an alias for the other . There are many reasons for such a work flow .

Also, the two should give you the same results . If not, then you are messing up somewhere . Read the docs for more understanding on this . https://laravel.com/docs/5.3/facades The docs are not wrong .

Please or to participate in this conversation.