How to install Laravel with XAMPP on Windows Using Composer

In this article we will give you a step-by-step guide on how to install Laravel with XAMPP on Windows Using Composer. Through Composer it’s simple and easy to install Laravel with XAMPP.

# Server Requirements

Since we want to work with the latest version of Laravel 5.6, make sure your server meets the following requirements:

  • PHP >= 7.1.3
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension

For more information, you can check the Server Requirements from Laravel official site.

# Install XAMPP

First thing you need to do is download the latest version of XAMPP that supports PHP 7.3.1 and Install it on Windows. For more details, see our step by step guide on How To Download And Install XAMPP On Windows.

# Composer

Once you have downloaded and installed XAMPP on Windows, then you need to do is Download Composer for Windows and Install it. For more details, see our step by step guide on How to Install Composer On Windows With XAMPP.

Laravel utilizes Composer to manage its dependencies. It must installed before setting up Laravel.

Once you successfully installed the Composer, open the command prompt. To open it, press Win + R keys on the keyboard, type in cmd and press the OK button

open command

Then type composer and press enter in the command prompt and you will get following response like in the below image.

# Install Laravel Framework

To install Laravel, First of all, you have to go C:/xampp/htdocs directoryto navigate it type following command in your command prompt:

cd c:/xampp/htdocs

Now we are ready to install Laravel, run the following command to install latest Laravel version:

composer create-project --prefer-dist laravel/laravel laravelproject

After running this command it should start downloading dependencies that are required to create the Laravel project.

start downloading dependencies for laravel

This installation may take a few minutes after executing the above command, so wait until you get success message like in the below image.

completed downloading dependencies for Laravel

After executing this command, it create a folder ‘laravelproject‘ under C:/xampp/htdocs directory with all it’s dependency.

When it completed, it will create following directory schema:

# XAMPP Virtual Host

We need to configure a Virtual Host in XAMPP for a Laravel project and in this example we want to configure the domain for our project. To do so, edit httpd-vhosts.conf file which is located within C:\xampp\apache\conf\extra\httpd-vhosts.conf

Add following code snippet at the end of your file:

# VirtualHost for

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/laravelproject/public"
    <Directory "C:/xampp/htdocs/laravelproject/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride All
      Require all granted

After this, apache server is listening to connections, but we have to configure our hosts file that allows to redirect to the localhost , to do so, edit the hosts file which is located within C:\Windows\System32\drivers\etc

Add following code snippet at the end of your file: localhost

Now everything is ready, restart the Apache server using the XAMPP control panel and type this URL in your browser and press enter.

run laravel project

Final Words

That’s it! I hope this article helped you learn to how to install Laravel with XAMPP Using Composer.

Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.

  1. emilio says

    and how I edit the hosts file if it is .txt?

    1. Vikas Kumar says


      First Right click hosts file and open file in notepad or any php editor.


  2. Shailesh Jha says

    composer create-project –prefer-dist laravel/laravel laravelproject
    After run command getting error –

    "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?

    do you know why ?

    1. Vikas Kumar says

      Hello Shailesh Jha,
      1) Try to update Composer, do it run below command in command prompt –

      composer self-update

      If above command don’t fix your problem then reinstall composer, For more details, see our step by step guide on How to Install Composer On Windows With XAMPP.

      Let me know.

      1. Shailesh Jha says

        After reinstall worked for me. Thanks a lot bro.

  3. tobi says

    good day, cannot edit the host file, saying access deny

  4. Peter says

    I cant access any of my localhost examples now and I can only see the laravel. how I get to see my other localhost/end.php examples?

  5. James says

    Microsoft Windows [Version 10.0.17763.615]
    (c) 2018 Microsoft Corporation. All rights reserved.

    C:\Users\Brownie>cd c:/xampp/htdocs

    c:\xampp\htdocs>composer create-project –prefer-dist laravel/laravel laravelproject

    The “
    son” file could not be downloaded: failed to open stream: HTTP request failed!

    create-project [-s|–stability STABILITY] [–prefer-source] [–prefer-dist] [–repository REPOSITORY] [–repository-url REPOSITORY-URL] [–dev] [–no-dev] [–no-custom-installers] [–no-scripts] [–no-progress] [–no-secure-http] [–keep-vcs] [–remove-vcs] [–no-install] [–ignore-platform-reqs] [–] [] [] []

  6. ebrar says

    it is very helpfull documentation, thank you..

  7. amir says

    there is a problem with me in composer i just setup the composer and i put the command of php artisan make:auth and there is a message says the make:auth not defined are there any one appeared that problem before

  8. Atheesh says

    Thank you very much. Very helpful!🙌

Leave A Reply

Your email address will not be published.