Laravel Project Structure
Explore the directory layout and understand each component's role.
Laravel Project Structure is a free PHP Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the PHP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What is Laravel?
Laravel is the most popular PHP framework, following the MVC pattern. It provides routing, Eloquent ORM, Blade templates, queues, events, and more out of the box.
Creating a Project
Bootstrap a new Laravel app with Composer.
$ composer create-project laravel/laravel my-app
$ cd my-app
$ php artisan serveThe app/ Directory
app/ contains your application code: Http/Controllers/, Models/, Providers/, Services/.
The routes/ Directory
routes/web.php — browser routes with session/CSRF middleware. routes/api.php — stateless API routes (prefixed with /api).
The resources/ Directory
resources/views/ — Blade templates. resources/lang/ — translation files. resources/css/ and resources/js/ — frontend assets.
The database/ Directory
database/migrations/ — version-controlled schema changes. database/seeders/ — seed data. database/factories/ — model factories for testing.
The config/ Directory
config/ contains configuration files: app.php, database.php, cache.php, mail.php. Values are read from .env via the env() helper.
The storage/ Directory
storage/logs/ — application logs. storage/app/ — uploaded files and generated content. storage/framework/ — cache, sessions, compiled views.
The public/ Directory
public/ is the web root. Only public/index.php (entry point) and public/assets/ should be web-accessible. Never expose app/ or .env.
Artisan CLI
php artisan is Laravel' command-line tool. Common commands: make:controller, make:model, migrate, serve, queue:work.
Service Providers
app/Providers/ contains service providers that bootstrap application services (binding interfaces, registering event listeners) in the container.
Summary
Laravel follows a standard MVC layout: controllers in app/Http/Controllers, models in app/Models, views in resources/views, routes in routes/. Use Artisan to generate boilerplate.
Quick Check
Where do Laravel API routes live by default?
Frequently asked questions
Is the “Laravel Project Structure” lesson free?
Yes — the full text of “Laravel Project Structure” is free to read here on the web, and the PHP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the PHP Academy course, upgrade to CoddyKit PRO.
What will I learn in “Laravel Project Structure”?
Explore the directory layout and understand each component's role. You practise PHP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start PHP Academy?
No prior experience is required. PHP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Laravel Project Structure” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this PHP Academy lesson?
Yes. Every PHP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Laravel Project Structure
- Defining Routes in Laravel
- Controllers and Actions
- Blade Templates and Views