Installing Laravel and Exploring Directory Structure
Learn how to use the Laravel installer to scaffold a new project and master the framework's directory structure to navigate your application with confidence.
Previously in this course, we set up our local development environment by installing PHP, Composer, and SQLite. Now that your machine is ready, we are going to perform our first project initialization and explore the directory structure that powers every Laravel application.
Creating Your First Project
The most efficient way to start a new project is by using the official Laravel installer. While you can use Composer directly, the installer provides a cleaner, more streamlined experience for scaffolding applications.
If you haven't already, install the installer globally via Composer:
Bashcomposer global require laravel/installer
Once installed, you can create your new project—which we will eventually turn into our Task Manager app—by running:
Bashlaravel new task-manager
The installer will prompt you with a few configuration questions (like your preferred testing framework or starter kit). For now, you can select the defaults. Once it finishes, move into your new directory:
Bashcd task-manager
Understanding the Directory Structure
Laravel follows a predictable, convention-over-configuration structure. While the number of files can look intimidating at first, every folder has a specific, well-defined purpose. Let’s break down the most critical directories you’ll interact with daily.
The app Directory
This is the heart of your application. Almost all of your custom code—models, controllers, and service logic—resides here.
Models/: This is where you’ll define your Eloquent models. As we discuss in Mastering Laravel Eloquent Model State: exists and wasRecentlyCreated, these classes represent your database tables.Http/Controllers/: This folder contains the logic that handles incoming web requests and returns responses.
The config Directory
Everything in your application that needs external configuration—like database credentials, mail settings, or timezones—lives here. You rarely change these files directly; instead, you'll modify your .env file, which feeds these configuration files.
The public Directory
This is the only directory accessible from the web. It contains your index.php file, which acts as the entry point for all requests to your application. You will also place your compiled assets (CSS, JavaScript, images) here. Never put your sensitive application logic or private configuration files inside public.
Other Key Folders
database/: Contains your migration files (which define your database schema) and database seeders.routes/: This is where you define your URL endpoints. Theweb.phpfile is where we will define the routes for our Task Manager.resources/: Houses your raw UI assets, including your Blade templates (the view layer) and uncompiled CSS/JS.
Hands-on Exercise: Locating Files
To ensure you are comfortable with the environment, perform these three tasks:
- Open your
task-managerproject in your code editor (VS Code, PhpStorm, etc.). - Navigate to
app/Modelsand locate theUser.phpfile. This is an example of an Eloquent model. - Open
routes/web.php. You will see a single route defined that returns awelcomeview. - Finally, look in the
config/folder and openapp.php. Scroll through the file to see how the application name and timezone are configured.
Common Pitfalls
- Editing files in the wrong place: Beginners often try to put business logic inside the
publicfolder. Remember:publicis for assets,appis for logic. - Ignoring the
.envfile: You might be tempted to hardcode API keys or database passwords directly into theconfig/files. Always use the.envfile for sensitive credentials to prevent them from being committed to version control. - Over-complicating the structure: Laravel is designed to be simple. If you find yourself creating a massive directory tree, you are likely over-engineering. Stick to the standard structure until you have a specific reason to deviate.
Recap
In this lesson, we successfully used the Laravel installer to scaffold our task-manager project. We reviewed the directory structure, highlighting that app/ is for your core logic, config/ handles settings, and public/ is your web-facing entry point. Understanding these locations is essential for the project initialization phase of any Laravel app.
Up next: We will dive deep into the .env file and learn how to manage application configuration securely.
Work with me

Laravel REST API Development
Clean, secure, well-documented Laravel REST APIs — the backend engine for your app, mobile client, or SaaS. Built by an API specialist.

FilamentPHP Admin Panel & Dashboard Development
A powerful admin panel for your Laravel app — built with FilamentPHP so you can manage everything without touching the database.