Xampp Virtual Host Laravel

How to Install Laravel 5.6 with Xampp on Windows

It is no news that Laravel is gaining immense popularity for its simplicity and robust features. Laravel is a PHP framework. Like any other framework, it needs a developing environment. You can use Laravel specific environments like Homestead or Valet, but if you are looking to setup Laravel with a Xampp, the well-known platform for PHP development, stick around.

# What’s Cooking?

Some fast Installations. We will start with installing Xampp in Windows, then move forward to install Composer and will finally install Laravel. We will also create a sample project and run in the browser.

# Laravel Basic Requirements

Since we want to work with the latest version of Laravel, i.e., v5.6, let us first have a look at the basic requirements:

The most concise screencasts for the working developer, updated daily. There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything!

  • #2 XAMPP Virtual Host. If you are looking to assign a permanent domain to your project, you can do so by configuring the xampp virtual host. We need to configure XAMPP Virtual Host to set the document root to correct directory of laravel project and to also assign a name to the project by which we will be accessing it in browser.
  • Create Virtual Host For Laravel.
  • 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

# Xampp for Windows


Download Xampp:

As we saw in the basic requirements, we need PHP >= 7.1.3. So let us try and download the latest version of Xampp that supports PHP 7.2.2.

Install Xampp:

Once, the download completes, initiate the installation process. It has quite a straightforward installation UI. Let me walk you through it:

Step 1:
If you are installing Xampp for the first time on your machine, you may see a UAC warning; you may ignore it for now and click OK

Set Virtual Host In Xampp Laravel

Step 2:
You will see primary Xampp setup screen, click Next

Step 3:
The next screen will ask you to select the components to set up; we will choose the default setup, so just click Next

Step 4:
You will be prompted to select the location to setup xampp. You may change it to D Drive or any other if you don’t want to lose the Xampp data during future system formats. I’ll go with the default setup and click Next

Step 5:
Next, you can choose if you want to know more about Bitnami, I’ll deselect the checkbox, and click Next:

Step 6:
The ready to install screen. You can go back from here if you want to change any of the previous settings or click Next

Step 7:
The installation process will finally begin and will take few minutes to unpack files and install them.

Step 8:
If you are prompted with a dialog box seeking firewall permissions, click on Allow Access.

Step 9:
Once the installation is successfully completed, keep the Do you want to start the Control Panel now? Checkbox selected and click on Finish.

In a moment, the screen to set default language will be shown. I’ll go with default selected option and click Save.

Step 11:
The Xampp Control Panel will be up.

Step 12:
Start Apache and MySQL Modules by clicking Start for each one. This will confirm the successful installation.

Step 13:
You can also check the same in browser. Just shoot localhost in the address bar, and it will open the default localhost/dashboard screen.

Also, to work with MySQL database, check localhost/phpmyadmin

That’s it. We successfully completed installing Xampp in Windows machine from scratch.

# Install Composer

Xampp Virtual Host Laravel Download

Composer, a PHP package manager has used manage Laravel dependencies. Hence it must installed before setting up Laravel.

Download Composer:

Firstly, download the windows installer for the composer from the official composer page.

Configurar virtual host xampp laravel

Installing Composer:

You can install the Composer on your own. Here are the steps for reference:

Set virtual host in xampp laravel

Step 1:
When you click on the downloaded installer, it will prompt the following screen. We don’t want to install the developer mode, so keep that unselected and click Next.

Step 2:
Composer setup needs to check the PHP configs, keep the default settings and click Next.

Step 3:
Since we won’t need any proxy, we can go with the default settings and click Next.

Step 4:
The installation setup is ready, so confirm it with the Install button.

Step 5:
Composer installation process will initiate.

Step 6:
The screen will prompt with some information. Though we won’t need those steps, read it and click Next.

Step 7:
Once the installation process completes, click on Finish button.

Step 8:
We can confirm the composer installation by running composer in the terminal or git bash. This command lists information and available commands in Composer.

Xampp server pdf. If you see the above output, the composer is setup successfully.

# Install Laravel

To install Laravel, we can Download the Laravel installer globally. Run it from any location:

Once this completes, optionally, you can go to C:xampphtdocs namespace and create a new folder to keep your Laravel projects aligned.

And from that specific folder, open a terminal and run:

Optionally, you can also create Laravel project via composer:

And here’s the Laravel project directory schema.

# Run Laravel Projects

Make sure that Apache and MySQL are running in Xampp Control Panel. You can run Laravel projects in various ways. Let us discuss them:
1. Artisan command
The most arbitrary way to run Laravel projects is with artisan command. Artisan is Laravel’s inbuilt command directory.

And then, open the following link in the browser:

If you see the Laravel welcome page in the browser, congratulations! Laravel is successfully set up on your machine.


2. Public Directory
The other way to run Laravel projects is with localhost. If your projects are located within htdocs folder, you can also run Laravel application in a similar way to running core PHP projects:

Remember, the public namespace of Laravel project is the main endpoint for your application.

3. Xampp Virtual Host
We can also configure Virtual Host for Laravel Projects and add a relevant domain. To do so, open httpd-vhosts.conf which is located within C:xamppapacheconfextrahttpd-vhosts.conf. Add following code snippet:

This enables Apache server to listen to laravel.test. We now need to redirectlaravel.test to localhost. To do so, edit the hosts file. It is located within C:WindowsSystem32driversetc.

Also, make sure that you open the file as an Administrator. Add:

Save the file and restart the system if required. You can then test the application with laravel.test in the browser.

It’s evident that all the three methods have the same output in the browser. You can choose whichever suits you best. We will use the first way, i.e., artisan command to test the application in future tutorials too. Its simple, fast and Laravel friendly.


The post was all about setting up Laravel on a Windows Machine with Xampp. To start with, we installed Xampp. Then we installed a Laravel dependency called Composer. And Finally installed Laravel. I walked you through the installation process step by step from scratch. We also created a fresh Laravel project and at the end, discussed various ways to run a Laravel application with Xampp.

Questions & Comments:

Thank you for reading. If you face any issues while installing Xampp or Laravel in your Windows system, share them in the comment section below.