Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kawax.biz/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

The best practice for Laravel development on Windows is to use WSL (Windows Subsystem for Linux). It lets you use the Linux toolchain directly, so the same commands work on macOS, your local Windows machine, and production servers. This guide walks you through installing PHP, Composer, and Node.js (via nvm) on Ubuntu inside WSL 2, all the way to a working laravel new setup.
Target environment: Windows 10 (version 2004 or later) or Windows 11, using WSL 2.

Installing WSL

1

Open PowerShell as Administrator

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

Install WSL and Ubuntu

wsl --install
This command installs WSL 2 and Ubuntu (the default distribution). Restart your PC when it finishes.
3

Set up Ubuntu

After restarting, Ubuntu will launch automatically. Set a username and password. This password will be used with the sudo command.
The password will not appear on screen while you type. Enter it carefully.
4

Update the package list

Run the following in the Ubuntu terminal:
sudo apt update && sudo apt upgrade -y

Installing PHP

Ubuntu’s default repositories may include an outdated PHP version. Use the ondrej/php PPA to install the latest version.
1

Install required packages

sudo apt install -y software-properties-common
2

Add the ondrej/php PPA

sudo add-apt-repository ppa:ondrej/php
sudo apt update
3

Install PHP 8.3 and the required extensions

Laravel 13 requires PHP 8.3 or higher.
sudo apt install -y php8.3 php8.3-cli php8.3-mbstring php8.3-xml php8.3-curl php8.3-zip php8.3-sqlite3 php8.3-mysql
4

Verify the version

php --version
You should see PHP 8.3.x or higher.
5

(Optional) Switch between multiple versions

If you need multiple PHP versions, switch between them using update-alternatives:
sudo update-alternatives --config php
A list of installed versions will appear. Enter the number of the version you want to use.

Installing Composer

Install Composer using the official installer.
1

Check required packages

sudo apt install -y curl php8.3-cli unzip
2

Download and run the official installer

curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
3

Verify the version

composer --version
4

Set the global install path

To use packages installed with composer global require (such as the Laravel installer), add ~/.composer/vendor/bin to your PATH.Add the following to ~/.bashrc (or ~/.zshrc):
export PATH="$HOME/.composer/vendor/bin:$PATH"
Apply the changes:
source ~/.bashrc

Installing nvm

Node.js is installed per-user using nvm (Node Version Manager). No sudo required, which makes it a great fit alongside AI tools and CLIs that rely on global npm packages.
1

Install nvm

Check the nvm GitHub repository for the latest install script.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
2

Add the snippet to your shell config

The install script automatically appends the following to ~/.bashrc. If it wasn’t added, do so manually:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
Apply the changes:
source ~/.bashrc
If you use zsh, add the same snippet to ~/.zshrc and run source ~/.zshrc.
3

Verify the installation

nvm --version

Installing Node.js

1

Install the LTS version

nvm install --lts
2

Set it as the default

Set the default version so it’s used automatically in new terminal sessions:
nvm alias default node
3

Verify the versions

node --version
npm --version

Verifying the Laravel Installation

1

Install the Laravel installer

composer global require laravel/installer
2

Create a new project

laravel new my-app
An interactive setup will begin where you can choose a starter kit, authentication options, and more.
3

Start the development server

cd my-app
php artisan serve
Open http://localhost:8000 in your browser. If you see the Laravel welcome page, you’re all set.
If you can’t access localhost from the Windows browser via WSL, try starting the server with php artisan serve --host=0.0.0.0.

Bonus: Tools to Boost Productivity

Windows Terminal

Windows Terminal lets you manage WSL, PowerShell, and Command Prompt in multiple tabs from one place. Install it for free from the Microsoft Store.
  • Run multiple shells in parallel using tabs
  • Set Ubuntu as the default shell
  • Freely customize fonts and color schemes

VS Code Remote - WSL Extension

The Remote - WSL extension for VS Code lets you edit files inside WSL directly from the Windows VS Code interface.
# Open your project in VS Code from the WSL terminal
code .
On first run, the VS Code server is automatically installed inside WSL. After that, you can develop with the same feel as a native environment.
Last modified on April 10, 2026