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

Image is loading...

Laravel, a free and open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller architectural pattern is getting more popular in nowadays. Laravel released it’s new 5.7 version on September 4th, 2018. It includes some extra features which help developers in many ways. Yes, Laravel is getting more popular among developers. In usual, developers choose Mac OS or any other Linux variants for the developing purposes. But we can not neglect the value of Windows the most using operating system in the world. Here I am explaining that how to install and setup Laravel 5.7 on Windows 10 using XAMPP



XAMPP is the most popular PHP development environment.XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.

XAMPP can be easily installed using the below URL.

Just install the latest version (7.2.9) from the list. It is to be noted that only 32-bit version is available for Windows platform, but it works fine in 64 bit Windows.

Image is loading...

Now you will get a XAMPP exe file on Downloads directory. Install this application by double-clicking it (Neglect the warnings by Windows). I have shown the screenshots of installation steps below.

Image is loading...



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 composer before installing Laravel. Just follow the below URL and download the Composer-Setup.exe file.

Image is loading...

Just install this exe file as you did before. I have shown some screenshots of the installation steps.

Image is loading...

Image is loading...


We need a terminal to go forward in this tutorial. Windows have Command Prompt and Powershell as default terminal but it feels a little bit uncomfortable. So I personally recommend git bash in place of Command Prompt. Git can be installed using the below link.

Image is loading...

Just install the exe file. I am not explaining the steps because you can execute the commands on Command Prompt also.

So after successful installation of Git, right click on the desktop and select Git Bash Here. This will open up a terminal and from now on, you can execute all the commands in the below steps within Git Bash. But first Chain Direct to the home directory using the below command.

cd ~

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


Now its time to install Laravel on the using composer by running the below command on git bash.

composer global require "laravel/installer"


After successful installation of Laravel, you can create a new app with the below command. AwesomeProject is the name I choose for my project

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

Now, wait for some time to complete the creation.


You can choose your own favorite code editor for editing your project. But in my case, I choose Visual studio Code(VS code). Using the below link, you can download VS code for Windows and install.


You can manually open your project directory(AwesomeProject) on VS code. You can also use git bash to open up the project on VS code using the below command.

cd ~/AwesomeProject
code .


You have to create a database on your Mysql server which is the DB of your Laravel application.

  • Direct to the URL below.

    Enter username and password(As a default, the username and password will be root).

  • Click on the New tab
  • Enter a database name

Press Create

Image is loading...


Edit the .env file in your project folder. If there is no .env file in your project, you have to create a file and paste all the contents from sample.env to the file you created and save the file with a .env filename.

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


You have to migrate the database from your Laravel application to your localhost using the below command.

php artisan migrate


On Terminal,

php artisan serv

Open a new tab on your browser with the URL below and you can the home page of the Laravel app we created.


If you wanted to open the app in another port,

On Terminal,

php artisan serv --port=9000

It will open the app with an address below.



If you are using Ubuntu OS, take a look at the tutorial below.

Have a nice code !

You May Also Like

About the Author: Syamlal CM

Hi, I'm Syamlal, the co-founder of Redmonark. I'm a developer, writer and also have a little bit of experience in graphic designing.


  1. Hi Syamlal, Thanks a lot for this great article. After following through all the documentation, I see this error. Please check.

    $ php artisan migrate
    Migration table created successfully.
    Migrating: 2014_10_12_000000_create_users_table

    Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 107
    1 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique

    at C:\Users\thele\AwesomeProject\vendor\laravel\framework\src\Illuminate\Database\Connection.
    660| // If an exception occurs when attempting to run a query, we’ll format the err
    661| // message to include the bindings with SQL, which will make this exception a
    662| // lot more helpful to the developer instead of just the database’s errors.
    663| catch (Exception $e) {
    > 664| throw new QueryException(
    665| $query, $this->prepareBindings($bindings), $e
    666| );
    667| }

    Exception trace:

    1 PDOException::(“SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was
    too long; max key length is 767 bytes”)

    2 PDOStatement::execute()

    Please use the argument -v to see more details.

    1. change the below in config/database.php
      Change to ‘charset’ => ‘utf8’,
      ‘collation’ => ‘utf8_unicode_ci’,

    2. To fix that problem, if you don’t want to change collation on your database:

      Go to AppServiceProvider.php in app\serviceproviders

      Add to top class:

      use Illuminate\Support\Facades\Schema;

      in public function boot add:


      save and run migration again: like php artisan migrate:fresh
      you shouldn’t have problems anymore.

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.