You are currently viewing How To Install And Setup Laravel 5.8 On Windows 10

How To Install And Setup Laravel 5.8 On Windows 10

Laravel, one of the best PHP framework is getting more popular among developers all around the world. The Model-View-Controller(MVC) 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.8 on Windows 10 using XAMPP on local server.

You can find the XAMPP installation steps from here. We are assuming you have already XAMPP installed on your machine and Apache and MYSQL module is already started on XAMPP control panel.

Server requirements for laravel 5.8

  • PHP >= 7.1.3
  • BCMath PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Laravel use Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.

Install Composer

The composer is a package manager for the PHP programming language that manage dependencies of PHP software and required libraries. Libarary can be install/update using composer. So we need to install composer before installing Laravel. Just follow the below URL and download the composer setup file.

https://getcomposer.org/download/
Composer Download

Below are some snapshot of installation steps.

Once composer installed successfully, You can check by typing “composer” on Command Line Interface(CLI) and it will print composer.

Install Laravel

Now open command prompt and set the path to htdocs folder usinng below command.

cd C:\xampp\htdocs

Laravel install using Laravel Installer

Now its time to install Laravel on our system using Laravel Installer. This can be done by running the below command in the Command Prompt. First, download the Laravel installer using Composer:

composer global require laravel/installer

Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog will create a directory named blog containing a fresh Laravel installation with all of Laravel’s dependencies already installed:

laravel new blog

Laravel install using Composer Create-Project

you can install Laravel by running the Composer create-project command in your terminal:

composer create-project --prefer-dist laravel/laravel blog "5.8.*"

Create Database

Now we need to create a database for our project in our MySQL server. This can be easily done using phpMyAdmin. Go to http://localhost/phpmyadmin and create a database. Here we have created laravel58.

Modify .ENV file

We can find 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 – laravel58)
DB_USERNAME=(Your Mysql username. Default: root)
DB_PASSWORD=(Your Mysql password. As a default, blank)

Running the application

Our laravel application can be run using the command below.

php artisan serve

Now you can open your application using below url.

http://localhost:8000

http://127.0.0.1:8000/

Migration Database

We can migrate database to local database from migration file to create table. The migration command is

php artisan migrate

Seeding database

Migration table only create table with empty data, To insert data into table we need to seed the table with data available in database seeds folder.

php artisan db:seed

Leave a Reply