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 wherelaravel new works.
Installing WSL
Open PowerShell as administrator
Install WSL and Ubuntu
Set up Ubuntu
sudo command.Update the package list
Installing PHP
The PHP shipped in Ubuntu’s default repository can be an older version. Install the latest version using theondrej/php PPA.
Install required packages
Add the ondrej/php PPA
Install PHP 8.3 and required extensions
Check the version
PHP 8.3.x or later.(Optional) Switching between multiple versions
update-alternatives.Installing Composer
Install Composer using the official installer.Verify required packages
Download and run the official installer
Check the version
Configure the path for global installs
composer global require (like the Laravel installer) are usable, add ~/.composer/vendor/bin to your PATH.Append this to ~/.bashrc (or ~/.zshrc):Installing nvm
Install Node.js on a per-user basis with nvm (Node Version Manager). Because it doesn’t requiresudo, it plays nicely with AI tools and CLIs that use global npm packages.
Install nvm
Add to your shell config
~/.bashrc. Add it manually if it isn’t already there.~/.zshrc and apply with source ~/.zshrc.Verify the installation
Installing Node.js
Install the LTS version
Set as default
Check the versions
Verifying the Laravel installation
Install the Laravel installer
Create a new project
Start the dev server
http://localhost:8000 in a Windows browser; if the Laravel welcome page appears, you’re done.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