How to Install and Setup Laravel 7 on Windows 10 Using XAMPP

Laravel one of the great PHP framework to build web applications released the new version which is Laravel 7 on March 3rd, 2020. They usually release the major versions every 6 months. Here we discuss the steps to install Laravel 7 on Windows 10.

If you are interested to know the version releases of Laravel, the below table will benefit you.

You can see that an LTS(Long Term Support) version is released by Laravel in September 2019. A lot of improvements are made in Laravel 7 compared to the Laravel 6 LTS.

  • Laravel Airlock
  • Custom Eloquent Casts
  • Blade Component Tags & Improvements
  • HTTP Client
  • Fluent String Operations
  • Route Model Binding Improvements
  • Multiple Mail Drivers
  • CORS Support
  • Query Time Casts
  • MySQL 8+ Database Queue Improvements
  • Artisan test Command
  • Markdown Mail Template Improvements
  • Stub Customization
  • Queue maxExceptions Configuration

I am not explaining more about these features in this article and if you would like to know those, please refer to the official release notes of Laravel 7.

So let us learn the steps for installing Laravel 7 on Windows 10 using XAMPP.

Steps to Install Laravel 7 on Windows 10

1. Install XAMPP

XAMPP is the most popular PHP development environment. It is completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. MariaDB is a community-developed, commercially supported fork of MySQL.

In our case, we are going to install and setup Laravel on Windows OS using XAMPP. We know that Laravel is a PHP framework and it needs PHP support, a server to run and a database to store data. These requirements are included in XAMPP.

The XAMPP open source package has been set up to be incredibly easy to install and to use.

First, download the XAMPP from the official website that I have given below.

Laravel 7 requires PHP >= 7.2.5. So download the latest version (7.3.3/PHP 7.3.3).

I have explained the XAMPP installation steps with the screenshots.

1. Select the components to install with XAMPP. Actually we only need Apache, MySQL, and phpMyAdmin. But here, I have selected all.

2. Select the installation folder. In default, it will be C:\xampp

3. So we have successfully installed Apache and MySQL. Now start the Apache and MySQL.

2. Install Composer

The composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. So we need to install the composer before installing Laravel. Just follow the below URL and download the Composer-Setup.exe file.
Image is loading...

I have shown some screenshots of the installation steps.

Image is loading...
Image is loading...

3. Install Laravel

Now its time to install Laravel on our system using composer. This can be done by running the below command in the Command prompt.

composer global require "laravel/installer"

4. Creating a New Application

After the successful installation of Laravel, we can create a new app with the below command. AwesomeProject is the name of the project I want to create.

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

Now, wait for some time to complete the creation process.

5. Create a Database

Now we need to create a database for our project in our MySQL server. This can be easily done using phpMyAdmin.

  • Open the link below. http://localhost/phpmyadmin  
  • Now Enter username and password(As a default, the username will be root password will be empty).

Now you can see phpMyAdmin panel where you can manage all the MySQL databases.

To create a database by clicking New from the left menu. Enter the database name and press Create.

  • Click on the New tab
  • Enter a database name
  • Press Create
Image is loading...

6. Modify .env File

So we have created the database successfully. Now open the Laravel app we have created in any editor. I recommend using Visual Studio code as the source-code editor for working with Laravel projects.

We can see a .env file inside the root directory of our project. Add our database details in this file which I have shown below.

DB_DATABASE=(The database name you created earlier - awesome_project_db)
DB_USERNAME=(Your Mysql username. Default: root)
DB_PASSWORD=(Your Mysql password. As a default, blank)
Image is loading...

7. Migrate Database

Now we have to migrate the database to the local database we created earlier. This can be done using the command below.

php artisan migrate

8. Running the Application

Our application can be run using the command below.

php artisan serv

This will open up a new tab on our browser with the URL below. This is the home page of our Laravel application.


Our app can also be run on another port using the command below.

php artisan serv --port=9000

This will open up our application in the port 9000



So, here in this article, we learned to install Laravel 7 on Windows 10 using XAMPP. I have also added some screenshots that help you with the installation procedure.

11 thoughts on “How to Install and Setup Laravel 7 on Windows 10 Using XAMPP

  1. Thanks for this article. Great help and very much updated. Though I have encountered problem in the part :

    php artisan migrate

    this was resolved by enabling my php extension in pdo_mysql in my php config

  2. I am getting error on php artisan migrate.

    The error says:


    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (SQL: select * from information_schema.tables where table_schema = awesome_project_db and table_name = migrations and table_type = ‘BASE TABLE’)

    at ____AwesomeProject\vendor\laravel\framework\src\Illuminate\Database\Connection.php:678
    674▕ // If an exception occurs when attempting to run a query, we’ll format the error
    675▕ // message to include the bindings with SQL, which will make this exception a
    676▕ // lot more helpful to the developer instead of just the database’s errors.
    677▕ catch (Exception $e) {
    ➜ 678▕ throw new QueryException(
    679▕ $query, $this->prepareBindings($bindings), $e
    680▕ );
    681▕ }

    1 _________________AwesomeProject\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
    PDOException::(“PDO::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known. “)

    2 __________AwesomeProject\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
    PDO::__construct(“mysql:host=mysql;port=3306;dbname=awesome_project_db”, “root”, “”, [])

    Any help is appreciated!! thank you.

  3. Thank you very much for this article. It helps me a lot to install laravel without installing that WSL feature on windows.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.