A new Laravel project has many folders. You will work in only a few of them every day.
The important folders
| Folder / file | What goes there |
|---|---|
app/Http/Controllers |
Controllers |
app/Models |
Eloquent models (User, Post) |
routes/web.php |
Web page routes |
resources/views |
Blade templates (.blade.php) |
database/migrations |
Table definitions |
config |
Configuration files |
public |
index.php, images, compiled CSS/JS |
storage |
Logs, cache, uploaded files |
vendor |
Packages installed by Composer |
.env |
Environment settings and passwords |
Request flow
Every request enters through public/index.php, then Laravel matches the URL in routes/web.php, runs a controller, and returns a view.
Tip
Only the public folder should be reachable from the web. On a live server, point the domain's document root at public, never at the project root.
Example
Example — Where each part of a page lives
PHP
<?php
// routes/web.php -> the URL
Route::get('/about', [PageController::class, 'about']);
// app/Http/Controllers/PageController.php -> the logic
public function about()
{
return view('about'); // loads resources/views/about.blade.php
}
// resources/views/about.blade.php -> the HTML
// <h1>About us</h1>
view('about') looks for resources/views/about.blade.php. Dots are folders: view('pages.about') loads resources/views/pages/about.blade.php.