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

Laravel, one of the best PHP framework is getting more popular among developers all around the world. The Model-View-Controller architecture and blade templating engine made Laravel simple and powerful. Here we are going to discuss the steps of installation and setup of Laravel 5.7 on Windows 10 using XAMPP.


Follow the steps below to start installing Laravel 5.7 on Windows 10:

1. Install 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 link below.

Laravel 5.7 requires PHP >= 7.1.3. Download the latest version (7.3.3/PHP 7.3.3).

I have shown some screenshots of the installation steps below.

2. Start Apache and MySQL

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

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

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

5. Creating a New Application

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

6. 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).
  • Click on the New tab
  • Enter a database name

Press Create

Image is loading...

7. Modify ENV File

We can see a .env file inside the root directory of our project. Add our database details in this file as 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...

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

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


TechoTip: We recommend using Visual Studio code as the source-code editor for working with Laravel projects.

Have a nice code !

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

  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.

  2. please i need help the laravel installation refused am getting this error

    $ composer global require “laravel/installer”
    Changed current directory to C:/Users/DE NOBLE PRINCE/AppData/Roaming/Composer

    Content-Length mismatch, received 2535 bytes out of the expected 1533081

    require [–dev] [–prefer-source] [–prefer-dist] [–no-progress] [–no-suggest] [–no-update] [–no-scripts] [–update-no-dev] [–update-with-dependencies] [–update-with-all-dependencies] [–ignore-platform-reqs] [–prefer-stable] [–prefer-lowest] [–sort-packages] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–] []…

  3. hi i have followed all the instruction and even downloaded and installed vstudio.
    so in step 7 where to modify env how do i go about it??

  4. Dear Syamlal CH , thank you for a very easy to follow tutorial.

    I followed all steps and just reached the end . Being new in Laravel, can you please add some project , a demo project , to test and see how Laravel framework actually works.

    So far installation of Laravel with XAMPP in Windows 10 is OK to have it installed, what NEXT ?

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.