Skip to main content

Introduction

The best practice for developing Laravel on Windows is to use WSL (Windows Subsystem for Linux). Because you can use the Linux toolchain as-is, the same commands work as on macOS and production servers. This guide walks through installing PHP, Composer, and Node.js (via nvm) on Ubuntu under WSL 2, getting you to a state where laravel new works.
Target environment: Windows 10 (version 2004 or later) or Windows 11. WSL 2 is used.

Installing WSL

1

Open PowerShell as administrator

Search “PowerShell” in the start menu and select “Run as administrator.”
2

Install WSL and Ubuntu

This command installs WSL 2 and Ubuntu (the default distribution). Restart the PC when it’s done.
3

Set up Ubuntu

After the restart, Ubuntu launches automatically. Set a username and password. This password is used for the sudo command.
The password won’t appear on screen as you type. Enter it accurately.
4

Update the package list

Run the following in the Ubuntu terminal.

Installing PHP

The PHP shipped in Ubuntu’s default repository can be an older version. Install the latest version using the ondrej/php PPA.
1

Install required packages

2

Add the ondrej/php PPA

3

Install PHP 8.3 and required extensions

Laravel 13 requires PHP 8.3 or later.
4

Check the version

Success looks like PHP 8.3.x or later.
5

(Optional) Switching between multiple versions

If you need multiple PHP versions, switch with update-alternatives.
A list of installed versions appears; enter the number of the one you want to use.

Installing Composer

Install Composer using the official installer.
1

Verify required packages

2

Download and run the official installer

3

Check the version

4

Configure the path for global installs

So that packages installed with composer global require (like the Laravel installer) are usable, add ~/.composer/vendor/bin to your PATH.Append this to ~/.bashrc (or ~/.zshrc):
Apply the changes.

Installing nvm

Install Node.js on a per-user basis with nvm (Node Version Manager). Because it doesn’t require sudo, it plays nicely with AI tools and CLIs that use global npm packages.
1

Install nvm

The latest install script is available on nvm’s GitHub repository.
2

Add to your shell config

The install script automatically appends the following to ~/.bashrc. Add it manually if it isn’t already there.
Apply the changes.
If you use zsh, add the same to ~/.zshrc and apply with source ~/.zshrc.
3

Verify the installation


Installing Node.js

1

Install the LTS version

2

Set as default

Set the default version so it’s used automatically in new terminal sessions.
3

Check the versions


Verifying the Laravel installation

1

Install the Laravel installer

2

Create a new project

An interactive setup begins. You can choose a starter kit and whether to include authentication.
3

Start the dev server

Open http://localhost:8000 in a Windows browser; if the Laravel welcome page appears, you’re done.
If you can’t reach localhost from a Windows browser under WSL, try running it with php artisan serve --host=0.0.0.0.

Extras: tools to improve productivity

Windows Terminal

Windows Terminal lets you manage WSL, PowerShell, and Command Prompt together in tabs. It’s free from the Microsoft Store.
  • Operate multiple shells in parallel with tabs
  • Set the Ubuntu shell as the default
  • Freely customize fonts and colors

VS Code Remote - WSL extension

With the Remote - WSL extension for VS Code, you can edit files inside WSL directly from VS Code on Windows.
On first run, the VS Code server is installed automatically inside WSL. From then on, development feels native.
Last modified on July 13, 2026