Laravel Directory Structure
Understanding the Laravel directory structure helps you know where every piece of code belongs. Laravel 11 slimmed down the default skeleton, so a new project has fewer files than older versions, but the main folders are the same.
The Main Folders
- app/ - your application code: Models, Http/Controllers, Providers and any classes you add
- bootstrap/app.php - configures routing, middleware and exception handling in Laravel 11
- config/ - configuration files like database.php and mail.php
- database/ - migrations, seeders and model factories
- public/ - the web root with index.php and compiled assets
- resources/ - Blade views, CSS and JavaScript sources
- routes/ - web.php and console.php (api.php is added with install:api)
- storage/ - logs, cache, compiled views and uploaded files
- tests/ - Feature and Unit tests
- vendor/ - Composer packages (never edit)
bootstrap/app.php in Laravel 11
Laravel 11 replaced the HTTP and console kernel classes with one fluent configuration file. You register route files, middleware and exception handling here.
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();(Default Laravel 11 bootstrap/app.php)
Where Does My Code Go?
- A new page: route in routes/web.php, controller in app/Http/Controllers, view in resources/views
- A database table: migration in database/migrations, model in app/Models
- Reusable business logic: a class in app/Services or app/Actions (you create these folders)
- Background work: a job in app/Jobs
- Scheduled tasks: routes/console.php
Generating Files With Artisan
You rarely create these files by hand. Artisan generates them in the right folder with the right namespace.
php artisan make:model Post -mc
php artisan make:request StorePostRequestINFO Model [app/Models/Post.php] created successfully. INFO Migration [database/migrations/2026_10_31_100000_create_posts_table.php] created successfully. INFO Controller [app/Http/Controllers/PostController.php] created successfully. INFO Request [app/Http/Requests/StorePostRequest.php] created successfully.
Public Files and Storage
Only the public folder should be reachable from the web. User uploads go in storage/app/public; run php artisan storage:link to create a public/storage symlink so those files can be served.
Frequently asked questions
Where is the Kernel.php file in Laravel 11?
It was removed. Middleware and exception handling are now configured in bootstrap/app.php.
Where are views stored in Laravel?
In resources/views, as files ending in .blade.php. Subfolders are referenced with dots, like view("posts.index").
Can I create my own folders inside app?
Yes. Composer autoloads everything under app with the App namespace, so app/Services/Billing.php becomes App\Services\Billing.