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.
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
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.
app DirectoryThis 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.config DirectoryEverything 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.
public DirectoryThis 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.
database/: Contains your migration files (which define your database schema) and database seeders.routes/: This is where you define your URL endpoints. The web.php file 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.To ensure you are comfortable with the environment, perform these three tasks:
task-manager project in your code editor (VS Code, PhpStorm, etc.).app/Models and locate the User.php file. This is an example of an Eloquent model.routes/web.php. You will see a single route defined that returns a welcome view.config/ folder and open app.php. Scroll through the file to see how the application name and timezone are configured.public folder. Remember: public is for assets, app is for logic..env file: You might be tempted to hardcode API keys or database passwords directly into the config/ files. Always use the .env file for sensitive credentials to prevent them from being committed to version control.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.
Master your Laravel environment setup by installing PHP, Composer, and SQLite. Get your terminal configured to start building our Task Manager application.
Read moreMaster Laravel task scheduling to automate recurring jobs with ease. Stop managing complex crontabs and learn the clean, native way to handle background tasks.
The Laravel Application Lifecycle
Initializing the Task Manager Project
Defining Basic Web Routes
Using Route Parameters
Creating Your First Controller
Returning Responses and Redirects
Task Manager: Implementing the Task List Route
Introduction to Blade Templating
Using Blade Layouts and Sections
Implementing Blade Partials
Mastering Blade Directives for Loops and Conditionals
Task Manager: Building the User Interface
Understanding Database Migrations
Working with Eloquent Models
Performing Basic CRUD Operations
Seeding the Database
Task Manager: Displaying Real Database Records
Capturing User Input from Forms
Introduction to Laravel Validation
Customizing Validation Error Messages
Using Form Requests for Validation
Introduction to Authentication
Protecting Routes with Middleware
Understanding CSRF Protection
Preventing Mass Assignment
Task Manager: Securing the Application
Introduction to Route Model Binding
Updating Existing Records
Deleting Records
Using Named Routes
Task Manager: Completing CRUD Functionality
Introduction to Database Relationships
Querying Related Data
Handling File Uploads
Using Flash Messages for User Feedback
Task Manager: Adding Status and Priorities
Introduction to Artisan Commands
Debugging with Laravel Tinker
Understanding Service Providers
Using View Composers
Task Manager: Refactoring for Clean Code
Introduction to Testing
Testing Forms and Validation
Using Database Transactions
Handling Global Exceptions
Preparing for Production
Environment Security Best Practices
Managing Assets in Production
Task Manager: Deployment Preparation