Laravel — P3: Directory Structure Basics

Dino Cajic
Geek Culture
Published in
4 min readDec 8, 2022

--

Dino Cajic on the Laravel Directory Structure

Where do you put your files? How does Laravel know? These are a few questions that I normally get from individuals just starting out with Laravel, or really any other framework. Laravel creates a folder structure for you and it expects certain files to appear in specific places. If they’re not there, Laravel will not know what to do. It expects your controllers to be in the Http folder, it expects your models to be in the Models folder, etc. If you’re not familiar with those concepts yet, don’t worry, we’ll cover each of them in length throughout this series. For now, lets look at some of the folders that we’ll spend most of our time in.

app/
Console/
Exceptions/
Http/
Controllers/
UserController.php
Middleware/
Models/
User.php
Providers/
bootstrap/
config/
database/
factories/

UserFactory.php
migrations/
2014_10_12_000000_create_users_table.php
...
seeders/
DatabaseSeeder.php
lang/
public/
resources/
...
views/
welcome.blade.php

routes/
api.php
...
web.php

storage/
...
logs/
tests/
Feature/

ExampleTest.php
Unit/
ExampleTest.php

vendor/
.env
.env.example

...

The items in bold above are the folders that we’ll cover in this article. We’ll make our way through the remainder of the directory as we increase our understanding of…

--

--

Dino Cajic
Geek Culture

Author of An Illustrative Introduction to Algorithms. IT Leader with a B.S. in Computer Science, a minor in Biology, and a passion for learning.