Labs ICT
โญ Pro Login

Project Structure

Understanding the files and folders.

Project Structure

When you create a Laravel project, you get a well-organized directory structure. Let's break down each folder so you know exactly where things go.

Think of this as your roadmap โ€” knowing the structure saves you hours of confusion later.

The app/ Directory

This is where your application logic lives. Models, controllers, middleware, services โ€” all go here. The app/ directory follows PSR-4 autoloading, meaning the namespace matches the directory structure.

app/
โ”œโ”€โ”€ Console/
โ”œโ”€โ”€ Exceptions/
โ”œโ”€โ”€ Http/
โ”‚   โ”œโ”€โ”€ Controllers/
โ”‚   โ”œโ”€โ”€ Middleware/
โ”‚   โ””โ”€โ”€ Kernel.php
โ”œโ”€โ”€ Models/
โ”œโ”€โ”€ Providers/
โ””โ”€โ”€ User.php

Your Models/ folder contains Eloquent models, Http/Controllers/ holds your controllers, and Providers/ manages service bindings.

Key Configuration Directories

The config/ directory contains all your configuration files as plain PHP arrays. Each file handles a specific concern โ€” database, cache, sessions, mail, and more. You rarely need to modify these directly, but it's good to know they're there.

config/
โ”œโ”€โ”€ app.php
โ”œโ”€โ”€ auth.php
โ”œโ”€โ”€ database.php
โ”œโ”€โ”€ cache.php
โ”œโ”€โ”€ session.php
โ””โ”€โ”€ mail.php

The database/ directory holds your migrations, seeders, and factories. The public/ directory is your web root โ€” it contains index.php, which is the entry point for all requests.

Try it Yourself โ†’

resources/ and routes/

The resources/ directory stores your views, raw CSS, JavaScript, and language files. Blade templates go in resources/views/.

The routes/ directory is where you define all your application's routes. Laravel organizes them into separate files by type:

routes/
โ”œโ”€โ”€ web.php
โ”œโ”€โ”€ api.php
โ”œโ”€โ”€ console.php
โ””โ”€โ”€ channels.php

The web.php file defines routes for your web interface, while api.php handles API endpoints. The artisan file at the project root is Laravel's command-line interface tool.

๐Ÿงช Quick Quiz

Where are the main application controllers stored in Laravel?