Installing Laravel on Windows 10: A Beginner’s Guide

Installing Laravel on Windows 10 - A Beginners Guide
Share this:

How to install Laravel on Windows 10? What are the prerequisites? How to get started?

Laravel is a free open source PHP framework. It provides tools for building web applications and APIs. The framework has gained popularity because of its simplicity and ease of use.

Laravel is a great choice for beginners who want to build their next project using PHP. In this tutorial, I’ll show you how to install Laravel on your PC or Mac.

Load WordPress Sites in as fast as 37ms!

Prerequisites:

  • PHP – PHP is an open-source, interpreted, and object-oriented scripting language that can be executed at the server-side. PHP is well suited for web development.
  • XAMPPXAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl.
  • VSCode (Use any code editor) – Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft with the Electron Framework, for Windows, Linux and macOS.

Before Installing Laravel in windows 10 make sure you have all above prerequisites list ready and running. PHP and XAMPP running.

Now, Lets look into the step’s:

Steps on Installing Laravel on Windows 10

  • Step 1: Install Composer
  • Step 2: Server Requirement for Installing Laravel
  • Step 3: Installing Laravel
  • Step 4: Creating Database
  • Step 5: Database Configuration
  • Step 6: Migrating Database
  • Step 7: Testing

Step 1: Install Composer

To install Composer in windows 10. Download Composer from there website getcomposer.org.

After you download it, run and install the composer. Click Next.

Composer Installation
Composer Installation

now you need to set the php path and click Next.

Composer Installation
Composer Installation

If you want to use proxy url then enter in next step or leave empty and click next.

Composer Installation
Composer Installation

Now its ready to install composer. Review it and click install.

Composer Installation
Composer Installation

Composer has been installed successfully.

Composer Installation
Composer Installation

How to check if composer has been installed on your windows or not.

First, Open terminal and enter the following command to check.

composer -v
Check if Composer has been Installed on your Windows
Check if Composer has been Installed on your Windows
Load WordPress Sites in as fast as 37ms!

Step 2: Server Requirement for Installing Laravel

Following are the Server Requirement for installing Laravel.

  • PHP >= 8.0 – Laravel 9.x requires a minimum PHP version of 8.0.
  • BCMath PHP Extension 
  • Ctype PHP Extension 
  • Fileinfo PHP extension 
  • JSON PHP Extension 
  • Mbstring PHP Extension 
  • OpenSSL PHP Extension 
  • PDO PHP Extension 
  • Tokenizer PHP Extension 
  • XML PHP Extension. 

Step 3: Installing Laravel

Now, Its time for Installing Laravel on Windows 10. Before creating your first Laravel project, you should ensure that your local machine has PHP and Composer installed.

In addition, we recommend installing Node and NPM.

After you have installed PHP and Composer, you may create a new Laravel project via the Composer create-project command:

As you had installed XAMPP. We are going to create a project inside C:\xampp\htdocs. Open the project folder in VS Code and Open the terminal and run the following command to install laravel.

Laravel Project Directory inside XAMPP
Laravel Project Directory inside XAMPP
composer create-project laravel/laravel example-app
Installing Laravel in Windows 10
Installing Laravel in Windows 10

Or, you may create new Laravel projects by globally installing the Laravel installer via Composer:

composer global require laravel/installer
 
laravel new example-app
Laravel Installed in Windows 10
Laravel Installed in Windows 10

Step 4: Creating Database

Now we are going to create a database in localhost. First open XAMPP and start Apache and MySQL as show below.

XAMPP Start Apache and MySQL
XAMPP Start Apache and MySQL

Open phpmyadmin by entering http://localhost/phpmyadmin in address bar.

Click New > Enter Database Name > Create

Creating Laravel Database
Creating Laravel Database

Step 5: Database Configuration

Now we are going to configure our laravel database. Open .env and enter the database details.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=example-app
DB_USERNAME=root
DB_PASSWORD=
Database Configuration
Database Configuration

Step 6: Migrating Database

To run all of your outstanding migrations, execute the migrate Artisan command.

php artisan migrate
Migrating Database
Migrating Database

If you want to install a fresh migration, you can execute the migrate Artisan command. This command effectively re-creates your entire database:

php artisan migrate:fresh

The above command will create a tables inside your database as you can in bellow image.

Tables Inside Database
Tables Inside Database
Load WordPress Sites in as fast as 37ms!

Step 7: Testing

As last, when everything has been done. we are going to test our application by running the serve command to start the laravel application.

php artisan serve
Laravel Start Development Server
Laravel Start Development Server

Now, open any web browser and open the following link to test the website.

http://127.0.0.1:8000
Installing Laravel on Windows 10: A Beginner's Guide
Installing Laravel on Windows 10: A Beginner’s Guide

Conclusion

This concludes our tutorial on Installing Laravel on Windows 10: A Beginner’s Guide. We hope you found it helpful. If you did, please like and share this article, and leave us a comment to let us know what you think. If you like the tutorial please subscribe our youtube channel and follow us on social network facebook and instagram.

Share this:

One thought on “Installing Laravel on Windows 10: A Beginner’s Guide

Leave a Reply