• Fri, Mar 2026

This beginner-friendly guide will walk you step by step through setting up Laravel on Windows, Mac, and Linux. We will cover everything from installing prerequisites like PHP and Composer to creating and running your first Laravel project. With clear explanations, code examples, and actionable steps, you’ll gain the confidence to start building applications with Larav

Laravel is one of the most powerful and elegant PHP frameworks available today. Whether you’re on Windows, macOS, or Linux, setting up Laravel properly is the first crucial step in your journey as a developer. This guide is designed like a professional tutorial script, so you can follow along as if you’re watching a step-by-step video or reading a course handout.


Understanding Laravel Requirements

Before we dive into installation, it’s important to know what Laravel needs to run. Laravel has some minimum server requirements. If these are missing, Laravel won’t function correctly.

RequirementMinimum Version
PHP8.1 or higher
ComposerLatest
DatabaseMySQL 5.7+, MariaDB, or PostgreSQL
Web ServerApache/Nginx (development uses built-in server)

Along with PHP, Laravel requires a few PHP extensions like BCMath, Ctype, Fileinfo, JSON, Mbstring, OpenSSL, PDO, Tokenizer, and XML. Don’t worry—most modern PHP installations include these by default.


Setting Up Laravel on Windows

Step 1: Install PHP

On Windows, the easiest way to install PHP is through XAMPP or WAMP. These packages include PHP, Apache, and MySQL in a single installer.

php -v

Run this command in your Command Prompt to verify installation.

Step 2: Install Composer

Composer is a dependency manager for PHP. Download the Windows installer from getcomposer.org.

composer -V

Step 3: Create Laravel Project

Once Composer is installed, create a new Laravel project using:

composer create-project laravel/laravel blog

Step 4: Serve Laravel

Move into the project directory and start the server:

cd blog
php artisan serve

Visit http://127.0.0.1:8000 in your browser to see the Laravel welcome page.


Setting Up Laravel on macOS

Step 1: Install Homebrew

On macOS, the best way to manage packages is via Homebrew. Install it with:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Install PHP

brew install php
php -v

Step 3: Install Composer

brew install composer
composer -V

Step 4: Create Laravel Project

composer create-project laravel/laravel blog

Step 5: Serve Laravel

cd blog
php artisan serve

You should now see the Laravel welcome page by visiting http://127.0.0.1:8000.


Setting Up Laravel on Linux

Step 1: Update Packages

sudo apt update && sudo apt upgrade

Step 2: Install PHP

sudo apt install php php-cli php-mbstring unzip curl php-xml composer git -y
php -v

Step 3: Install Composer

composer -V

Step 4: Create Laravel Project

composer create-project laravel/laravel blog

Step 5: Serve Laravel

cd blog
php artisan serve

Open http://127.0.0.1:8000 in your browser. Congratulations—you’ve successfully installed Laravel on Linux!


Verifying Installation

No matter your operating system, after serving Laravel, you should see the default Laravel welcome page.


Common Issues and Fixes

Sometimes you may face issues during setup. Here are common errors and solutions:

ErrorCauseFix
Command php not foundPHP not installed or not added to PATHReinstall PHP and update system PATH
Composer not recognizedComposer not added to PATHReinstall Composer and check PATH
Missing PHP extensionsRequired extensions not installedInstall extensions like mbstring, xml, pdo

Next Steps After Setup

Now that you have Laravel installed, here’s what you can explore next:

  • Create controllers and routes
  • Learn Blade templating engine
  • Work with databases using migrations and Eloquent ORM
  • Experiment with Artisan commands
  • Build your first CRUD application

Conclusion

Setting up Laravel may look different across Windows, Mac, and Linux, but the fundamentals remain the same: install PHP, install Composer, create a project, and run it. With your Laravel environment now ready, you are well on your way to mastering modern PHP development.

Happy coding, and welcome to the Laravel community!

This website uses cookies to enhance your browsing experience. By continuing to use this site, you consent to the use of cookies. Please review our Privacy Policy for more information on how we handle your data. Cookie Policy