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
Open PowerShell as Administrator
Search for “PowerShell” in the Start menu and select “Run as administrator”.
Install WSL and Ubuntu
This command installs WSL 2 and Ubuntu (the default distribution). Restart your PC when it finishes. 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.
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.
Install required packages
sudo apt install -y software-properties-common
Add the ondrej/php PPA
sudo add-apt-repository ppa:ondrej/php
sudo apt update
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
Verify the version
You should see PHP 8.3.x or higher. (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.
Check required packages
sudo apt install -y curl php8.3-cli unzip
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
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:
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.
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
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:If you use zsh, add the same snippet to ~/.zshrc and run source ~/.zshrc.
Installing Node.js
Set it as the default
Set the default version so it’s used automatically in new terminal sessions: Verify the versions
node --version
npm --version
Verifying the Laravel Installation
Install the Laravel installer
composer global require laravel/installer
Create a new project
An interactive setup will begin where you can choose a starter kit, authentication options, and more. 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.
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.