1. Code
  2. PHP
  3. Laravel

How to Install Laravel on Windows

Scroll to top
Scroll to top
Read Time: 4 min

Laravel is a PHP framework that is used to build Laravel applications. Before you create your first application with Laravel, make sure you have PHP and Composer installed. Composer is used to install Laravel. In this post, I will show you how to install Laravel from start to finish.

Setting Up a Laravel Environment

There are different ways to install Laravel on your machine, and your choice depends on your operating system. Laravel provides detailed documentation on the different options. The official recommendation is to use Docker Desktop, but in this lesson we'll be using XAMMP to install PHP, and then we'll set up Laravel manually.

Steps for Installing Laravel

The installation of Laravel can be achieved in three easy steps:

  1. Download and install XAMPP (or MAMP for Mac) to get PHP and MySQL.
  2. Download and install Composer.
  3. Install Laravel with Composer.

Watch this video for a complete guide:

In order to build Laravel applications, we first need to install PHP and MySQL on our machine. 

Other Ways of Installing PHP and Composer

These two articles will show you ways of installing PHP and Composer.

How to Install XAMPP on Windows

In order to build Laravel applications, we need to install PHP and MySQL on our machine. The easiest way to install PHP on Windows is through XAMPP. It is available on all three desktop operating systems—Windows, Linux, and Mac. However, on Mac it's best to use MAMP, which is compatible with the new M1 and M2 chips.

Now let's take a look at how to install XAMMP on Windows. 

Go to https://www.apachefriends.org/download.html and download the installer for your operating system. Select the latest version of PHP, i.e. the one at the bottom of the list.

Install wizard xammp pic 1 Install wizard xammp pic 1 Install wizard xammp pic 1

1. Install Wizard

Double-click the installer, and then follow the prompts. 

2. Installer Settings

You won’t need to change any of the installation settings—the defaults are all good as is.

xammp select components pic 2xammp select components pic 2xammp select components pic 2
xammp location pic 3xammp location pic 3xammp location pic 3

3. Installation Folder

Of particular note, you should leave the installation drive as the C:\ drive on Windows in order for things to function correctly.

You may also need to grant approval for XAMPP’s Apache installation to have network access through Windows Defender or any other firewall you might be running.

4. Control Panel

Continue following the prompts. When the installation is complete, leave the option checked that says Do you want to run the Control Panel now? Then close the installer, and you’ll see the XAMPP Control Panel appear.

If you missed the chance to leave that box checked, just run XAMPP from your list of installed software to start the Control Panel.

xammp control panel pic 4xammp control panel pic 4xammp control panel pic 4

How to Install Composer

Once you have PHP installed on your system, it's easy to install Composer. First, download it from the Composer website.

Composer setup and installation options Composer setup and installation options Composer setup and installation options

1. Install Composer 

Click on the downloaded Composer-Setup.exe file (for Windows) or the equivalent for your operating system. Run the installer, and it will install the latest Composer version.

2. Adjust the System Path 

Add the PHP executable to your system path using the installer. 

Composer PHP Path Composer PHP Path Composer PHP Path
Composer - Choose ProxyComposer - Choose ProxyComposer - Choose Proxy

3. Proxy Server Setup

If you don't have a proxy server, just click Next.

4. Install

Composer is now ready to install, and the setup wizard will download files onto your machine.

Composer Ready to InstallComposer Ready to InstallComposer Ready to Install
Test Composer on Command Prompt Test Composer on Command Prompt Test Composer on Command Prompt

5. Test 

You want to be sure that Composer will run without hitches. 

Open the command prompt or terminal, and run the command composer --version. You should see the current Composer version printed to the terminal.

How to Install Laravel

1. Open the Terminal

Now that you have installed PHP and Composer, creating a Laravel project is straightforward. Open your terminal.

Open Command Prompt / TerminalOpen Command Prompt / TerminalOpen Command Prompt / Terminal

2. Create a Laravel Project

Run the command below to create a brand new project inside a folder named my-app (or any project name you wish):

composer create-project laravel/laravel my-app

This will download all the necessary Laravel files for this project.

3. Start the Development Server

After the application has been created, cd into my-app and start your development server using the following commands:

cd my-app
php artisan serve

4.  Browse to Your New Laravel App

We are done setting up the environment. You should be able to access your Laravel development server at https://localhost:8000.


Next Steps

That's it—you've successfully installed Laravel and run your first app. But this is just the beginning! Now you can learn to build websites and apps with this powerful and easy-to-use framework. Get started with our complete guide to learning Laravel.

Learn Laravel With a Free Online Course

The best way to get started learning Laravel is with a free course from Envato Tuts+.

2.4 Hours

Get Started With Laravel

Want to learn Laravel from start to finish? Watch this comprehensive free course! Join Jeremy McPeak as he teaches you everything you need to get started with Laravel.  

    Did you find this post useful?
    Want a weekly email summary?
    Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
    Looking for something to help kick start your next project?
    Envato Market has a range of items for sale to help get you started.