Article image


Laravel -

Aug 26 2019

Dino Numic

This article will cover how to install and create a local development environment for your Laravel application. There are only a couple of steps that we need to complete.


Xampp is an open source and completely free PHP development environment which includes Apache server, MariaDB database, as well as interpreters for PHP and Perl.

It is intended to be used only as a development tool because it allows the developers to easily develop and test their web applications on their local machines.

Grab an installer from the official Xampp website.

As you see, Xampp is available for Windows, Linux, and Mac OS as well. After it downloads go ahead and start the installation process. 

This is Xampp folder structure. Every web application including Laravel should be placed within htdocs folder. It is a good idea to create a folder for each web site you create in order to prevent conflicts and strange behavior. For Laravel it is not necessary as we will specify folder name once we execute the project create command.


We will use Composer to install new Laravel application. Composer is a PHP package manager which allows us to install various PHP packages, including Laravel, update, and manage all the necessary dependencies. 

You can download Composer from the official website. After it downloads go ahead and start the installation. If you are using other operating system than the Windows, you can find installation instructions on the website. After the installation is completed we can check that it works by calling composer from the command line terminal.

Press windows home button and an R key on the keyboard. After CMD is opened type in composer and hit enter.

If you can see the following message in your terminal than Composer is installed successfully.


Finally, we can install Laravel by using a Composer command. Now, don’t forget, we have to be in the htdocs folder. From the current terminal position you can copy or type in the following in order to go to htdocs: “cd ../../xampp/htdocs”.

Once inside the folder we can run: "composer create-project --prefer-dist laravel/laravel myproject". Depending on your hardware and internet speed, installation process should not take more than couple of minutes. You can grab a glass of water or a snack until it finishes.

Serving the application

We now have two options of serving our freshly installed Laravel application. We can either call an artisan command inside our Laravel folder.

php artisan serve which will server the application on http://localhost:8000 local address.

The second option is to serve it with xampp and for that we will have to create a virtual host within xampp configuration.

This is where you need to go: C:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost myproject.test:80>
  DocumentRoot "C:\xampp\htdocs\myproject\public"
  <Directory "C:\xampp\htdocs\myproject">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

We have told apache to listen to the connection on myproject.test. Next, we have to modify our hosts file which will redirect myproject.test to the localhost.

Hosts file is located here: C:\Windows\System32\drivers\etc

Add the following line:  myproject.test

Now you can start apache service and open the browser page on the domain you entered in virtual host and hosts file.