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

michalis's avatar

Illuminate\Http\Request

guys Im a novice here so please forgive my ignorance

but what is the difference between

use Illuminate\Http\Request;

use Request;

use App\Http\Requests;

0 likes
8 replies
bashy's avatar
bashy
Best Answer
Level 65

Illuminate\Http\Request and Request are the same?

Alias in app.php

'Request'   => Illuminate\Support\Facades\Request::class,

Which in turn just loads the facades: https://github.com/laravel/framework/blob/5.1/src/Illuminate/Support/Facades/Request.php

App\Http\Requests; allows you to use the classes in the Requests folder: https://github.com/laravel/laravel/tree/master/app/Http/Requests so you can load them in your controller (Requests\SomeFormRequest $request)

1 like
michalis's avatar

ok I think I understand more or less

so a facade is just a fancy way of accessing the request method?

chuckc's avatar

Are you sure that Request and Illuminate/Http/Request are the same ?

Because in my app, if I use Request, then call $request->file('file') for example, it fails. However, if I use Illuminate/Http/Request, it succeed.

I have some trouble figuring this, even after trying to understand Facades.

chuckc's avatar

For example, I have a controller that needs Request and Illuminate\Http\Request. The only way I found to make it work together is by using aliases:

use Illuminate\Http\Request as HttpRequest;
use Request;

I believe those two classes frequently used together, so I have the feeling something is wrong.

bashy's avatar

@chuckc Have it like this

use Illuminate\Http\Request;
public function index(Request $request)
{
    var_dump($request->all());
    dd($request->url());
}

You will see the POST/GET data and the current URL for the site. You can retrieve files from that.

$request->file('file');
1 like
chuckc's avatar

Oh okay I see, the problem is that I used the static method. Thanks @bashy

MaheshSharma's avatar

use App\Http\Requests It simply means you can access all classes in use App\Http\Requests namespace(folder)...

Please or to participate in this conversation.