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

INSTALLATION




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

https://www.apachefriends.org/download.html

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

 

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

https://getcomposer.org/download/

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

3. INSTALL GIT

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.

https://git-scm.com/downloads

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

4. INSTALL LARAVEL

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

composer global require "laravel/installer"




5.CREATING NEW APPLICATION

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.

6. CHOOSING THE CODE EDITOR

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.

https://code.visualstudio.com

7. DIRECTING TO YOUR PROJECT FOLDER AND EDITING

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 .

8. CREATING DATABASE

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

  • Direct to the URL below.
    http://localhost/phpmyadmin
    

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

9. EDIT .ENV

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

10. MIGRATE DATABASE

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

php artisan migrate




11. RUNNING YOUR APPLICATION

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.

http://localhost:8000

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.

http://localhost:9000

 

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

https://www.techomoro.com/how-to-install-and-setup-laravel-5-6-on-ubuntu-17-10/

Have a nice code !

You May Also Like

About the Author: Syamlal CM

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.