Laravel remains one of the most popular PHP frameworks for building modern web applications. Developers around the world use it to create everything from personal blogs and company websites to REST APIs and enterprise-level applications. Its elegant syntax, built-in tools, and active community make it a favorite among both beginners and experienced programmers.

Before you can start building with Laravel, you need to prepare your development environment. Fortunately, installing Laravel is straightforward on Windows, macOS, and Linux. The framework relies on PHP, Composer, and a few required extensions, all of which can be installed in just a few steps.

This guide explains how to install Laravel on the three major desktop operating systems, verify that everything is working correctly, and create your first Laravel project.

System Requirements

Before installing Laravel, make sure your computer meets the basic requirements.

You’ll need:

  • PHP 8.2 or later (or the version recommended by the Laravel release you’re using)
  • Composer
  • Git (recommended)
  • A web browser
  • A code editor such as Visual Studio Code

Laravel also requires several PHP extensions, including:

  • BCMath
  • Ctype
  • Fileinfo
  • JSON
  • Mbstring
  • OpenSSL
  • PDO
  • Tokenizer
  • XML

Most modern PHP installations already include these extensions.

Step 1: Install PHP

Laravel is built on PHP, so installing PHP is your first step.

Windows

Download PHP from the official PHP website or install an all-in-one local development package such as Laragon or XAMPP.

See also  Fastest way to upgrade laravel 5.2 app to laravel 9

After installation, open Command Prompt and run:

php -v

If PHP is installed correctly, you’ll see the installed version displayed.

macOS

If you use Homebrew, install PHP with:

brew install php

Verify the installation:

php -v

Linux

Ubuntu and Debian users can install PHP using:

sudo apt update
sudo apt install php php-cli php-mbstring php-xml php-bcmath php-curl unzip

Verify:

php -v

Step 2: Install Composer

Composer is PHP’s dependency manager. Laravel uses Composer to install packages and create new projects.

Download Composer from the official website and follow the installation instructions for your operating system.

After installation, verify it works:

composer --version

You should see the installed Composer version.

Step 3: Install Git

Although Git isn’t mandatory, it’s highly recommended for version control and downloading packages.

Verify Git is installed:

git --version

If Git isn’t installed, download it from the official Git website.

Step 4: Install the Laravel Installer

Laravel provides an official installer that makes creating new projects much faster.

Install it using Composer:

composer global require laravel/installer

After installation, verify:

laravel --version

If the command isn’t recognized, add Composer’s global bin directory to your system PATH.

Step 5: Create Your First Laravel Project

Now you’re ready to build your first application.

Create a new project:

laravel new myproject

Alternatively, you can use Composer:

composer create-project laravel/laravel myproject

Laravel will download all required packages automatically.

See also  Right Way of SDLC Software Development Lifecycle - (explained with Laravel)

Step 6: Open the Project

Navigate into your project folder:

cd myproject

Open it in Visual Studio Code:

code .

If the command isn’t recognized, launch VS Code and open the project folder manually.

Step 7: Start the Development Server

Laravel includes a built-in web server.

Run:

php artisan serve

You’ll see something similar to:

INFO Server running on http:<em>//127.0.0.1:8000</em>

Open that address in your browser.

If everything was installed correctly, you’ll see Laravel’s welcome page.

Project Structure

install laravel

After installation, your project contains several folders.

Some of the most important include:

app/

Contains controllers, models, middleware, and application logic.

routes/

Stores web and API routes.

resources/

Contains Blade templates, CSS, JavaScript, and language files.

database/

Includes migrations, factories, and seeders.

public/

The web server points to this folder.

storage/

Stores logs, cache files, and uploaded content.

Updating Laravel

To update dependencies later, run:

composer update

To install new packages:

composer require package-name

Common Installation Problems

Composer Not Found

If your terminal says Composer isn’t recognized, ensure Composer is installed and added to your system PATH.

PHP Not Recognized

This usually means PHP hasn’t been added to the PATH environment variable.

Restart your terminal after making changes.

Missing PHP Extensions

Laravel may display errors about missing extensions.

Install the required extension for your operating system, then restart your terminal or web server.

Permission Errors on Linux

Sometimes storage directories need write permission.

See also  Right Way of SDLC Software Development Lifecycle - (explained with Laravel)

Run:

chmod -R 775 storage bootstrap/cache

Useful Artisan Commands

Laravel includes Artisan, a powerful command-line tool.

Check available commands:

php artisan

Create a controller:

php artisan make:controller UserController

Create a model:

php artisan make:model Product

Run database migrations:

php artisan migrate

Clear application cache:

php artisan cache:clear

Best Development Tools

Many Laravel developers use these tools:

  • Visual Studio Code
  • PHPStorm
  • Git
  • Composer
  • Laravel Pint
  • Laravel Sail
  • Laravel Herd (Windows and macOS)
  • MySQL or PostgreSQL

These tools simplify development and improve productivity.

Frequently Asked Questions

Is Laravel free?

Yes. Laravel is open-source and free to use for personal and commercial projects.

Do I need Composer?

Yes. Composer is required because Laravel manages its dependencies through Composer.

Can Laravel run on Windows?

Absolutely. Laravel works on Windows, macOS, and Linux.

Which database does Laravel support?

Laravel supports multiple databases, including MySQL, MariaDB, PostgreSQL, SQLite, and SQL Server.

Is Laravel suitable for beginners?

Yes. Laravel has excellent documentation, a large community, and many built-in features that make learning web development easier.

Conclusion

Installing Laravel is a straightforward process once PHP and Composer are in place. Whether you’re using Windows, macOS, or Linux, the setup steps are largely the same: install the required software, create a new project, and launch the built-in development server.

With Laravel successfully installed, you’re ready to explore routing, controllers, Blade templates, Eloquent ORM, authentication, and the many other features that make Laravel one of the most powerful PHP frameworks available today.

IT Consultant, Photographer, Blogger

Leave a Reply