How to Install Laravel 5.7 with XAMPP on Windows

Requirements

  • Windows Installed System.

Laravel 5.7 requires PHP version 7.1.3 or more, and some other extensions. Since we are doing setup on XAMPP, it has all the required php extensions within it.  Make sure to Install the XAMPP with version >=7.2.0

 

Install XAMPP

First of all we need to download and install XAMPP for Linux. Download it from the apache friends official website. Download the XAMPP version > 7.2.0 which contains PHP version 7.1.3

xampp install windows

Follow the steps for XAMPP installation. For Windows, the default  installation directory for XAMPP is C:\xampp

xampp windows location

Once the XAMPP is installed you should be able to access its manager console.

If your XAMPP is correctly installed and apache web server if turned on in the xampp control panel, You should see this page when you access http://locahost in your browser.

xampp default dashboard

 

Composer

Once you are done with XAMPP, it’s now time to setup Composer.

Composer is a dependency management or package management tool which is integrated with Laravel Framework. Check by running composer command in your terminal if your system has composer already installed in it.

If not you can install it by following this tutorial How to Install Composer on Windows

Install Laravel Framework

The default directory of XAMPP for installing or keeping PHP project is htdocs. Navigate to following directory in your terminal C:\xampp\htdocs and run following composer command to create a fresh Laravel 5.7 version

composer create-project laravel/laravel myProject "5.7.*"

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

composer laravel install windows

When it finishes it will create a Laravel 5.7 project with following data structure.

Run Laravel Project

Now, it’s time to run the Laravel project that we have installed. There are couple of ways you can do this.

#1 Artisan Command

Artisan command are built into the Laravel library, and one of it’s command it to serve the project on server. Navigate to the directory in which you have created your new laravel project and run following command.

php artisan serve

And then, open the following link in the browser: http://localhost:8000

#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.

Navigate and open file C:\xampp\apache\conf\extra\httpd-vhosts.conf and include following Virtual host entry in this file.

<VirtualHost laravel.local:80>
    DocumentRoot "C:\xampp\htdocs\myProject\public"
    ServerAdmin laravel.local
    <Directory "C:\xampp\htdocs\myProject">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

With this entry our apache is listening to laravel.local, but we also have to edit our hosts file to include an entry for the new domain.

Edit file C:\Windows\System32\drivers\etc and add following entry to that file.

127.0.0.1 laravel.local

Restart your apache and access laravel.local on your browser you should be able to see this screen.

Have Fun working with Laravel !

If you are looking for an updated tutorial that works with Laravel 5.8 and particularly gives details on setting up Laravel on Server checkout this tutorial -> Install Laravel.

Related Articles

If you like our content, please consider buying me a coffee.

Thank you for your support!

Buy me a coffeeBuy me a coffee

10 comments On How to Install Laravel 5.7 with XAMPP on Windows

Leave a reply:

Your email address will not be published.

Site Footer