DEV Community

Cover image for How to Set Up Your First Laravel Project Using Composer — Quick and Easy!
Abhishek Shakya
Abhishek Shakya

Posted on

How to Set Up Your First Laravel Project Using Composer — Quick and Easy!

If you’re stepping into the world of Laravel development, this guide is exactly what you need. Laravel is a modern PHP framework known for its elegant syntax and powerful features that make web development fun and productive.

In this article, we’ll walk you through setting up your very first Laravel project using Composer — step-by-step, with simple instructions anyone can follow.

🚀 What You’ll Learn:
What is Composer and why it’s important
How to install Laravel using Composer
Setting up your development server
Running your first Laravel project
🧰 Prerequisites
Before we begin, make sure you have the following installed on your system:

✅ PHP (v8.1 or higher recommended)
✅ Composer (dependency manager for PHP)
✅ A local server like XAMPP, WAMP, Laravel Valet, or Docker
✅ Basic understanding of the terminal/command prompt

🛠 Step 1: Install Composer
Composer is the official dependency manager for PHP. Laravel uses Composer to manage its libraries and packages.

🔽 To install Composer:
Visit the official website 👉 http://getcomposer.org
Download the installer for your OS and follow the instructions.

Once installed, run this command to verify:

composer --version
📦 Step 2: Create a New Laravel Project
You can create a new Laravel project in just one command using Composer.

Open your terminal and run:
composer create-project laravel/laravel myFirstLaravelApp
Here, myFirstLaravelApp is your project folder name — you can change it to whatever you like.

⏳ Step 3: Wait for Installation
Composer will download Laravel and all required dependencies. This may take a few minutes depending on your internet speed.

Once done, navigate into your new project folder:

cd myFirstLaravelApp
💻 Step 4: Start Laravel’s Development Server
Laravel comes with a built-in development server to quickly test your application.

Just run:

php artisan serve
You’ll see an output like:

Starting Laravel development server: http://127.0.0.1:8000
Open that link in your browser and… 🎉 You’re live with Laravel!

🧪 Step 5: Explore the Project Structure
Let’s quickly look at some important folders:

app/ – Your application logic lives here (Controllers, Models, etc.)
routes/web.php – Define web routes here
resources/views/ – Blade templates (Laravel’s templating engine)
.env – Your environment settings (DB config, app key, etc.)
🎁 Bonus Tips
Use Visual Studio Code for a smooth coding experience.
Learn Laravel Artisan commands (php artisan list) to speed up development.
Version control with Git is highly recommended.
✅ Wrapping Up
That’s it! You’ve just created your first Laravel project using Composer. 🎉

Laravel is an amazing framework that’s beginner-friendly yet incredibly powerful. This first step opens the door to building complex, real-world applications with ease.

✨ Was this guide helpful?
Clap 👏, share with your dev friends, and leave a comment below if you want a follow-up tutorial on Laravel routing, controllers, or authentication!

Laravel #PHP #WebDevelopment #Composer #BeginnerDevelopers #MediumDev #Tutorial

Top comments (0)