How to install Laravel Framework on Windows using Xampp?

This article covers all steps to installing fresh Laravel application on windows. Before getting started make sure that a few software is installed and configured well. Following is the software that needs to be installed,

  1. Xampp
  2. Composer
  3. Git Bash

Required Software:

Let’s install and configure the software that is required for installing the Laravel application.

1. Xampp:

Xampp is a free and well-reputed web server that runs multiple programming languages including PHP and its applications on the local server developed by Apache Friends. For installing Xampp on windows, go to apachefriends.org and download the .exe file that should have PHP version 8 or above. On the download page, under the section of XAMPP for Windows, the file version name looks like the below,

8.0.19 / PHP 8.0.19

Once the .exe file is downloaded, then install it. You can follow the installation steps on wpmudev.com

2. Composer

Composer is a dependency management tool of PHP that provides a facility for declaring application dependencies, then it helps to manage them in installation and updating on the end-user. To install composer, go to getcomposer.org and click on Composer-Setup.exe to download and run it. If you are looking for complete installation steps then go to devdude.com and follow the steps.

3. Git Bash

It is an application that provides a better interface to run commands and show status for windows environments. Bash is an acronym for Bourne Again Shell. To install Git Bash go to git-scm.com and download and install it. For complete installation, steps click on educative.io

Install Laravel Framework:

Go to Xampp/htdocs directory and right-click, you should see an option for “Git Bash Here”. If you are on Windows 11 or you don’t see it then open the git bash terminal and write the run below commands,

cd C:

Here, I assume that Xampp is installed into the C drive, in case it is installed in any other drive then change C accordingly. Usually, Windows installs every software into C drive by default.

Next, run the below command that would let you in xampp/htdocs directory,

cd xampp/htdocs

Now, it’s time to install the Laravel application so run the below command that would create the fresh application.

composer create-project laravel/laravel this-is-your-application-name

This command tells the composer to install the Laravel application with the name this-is-your-application-name as you see it is the last part of the command. It can be changed with any name, so the last part of the command text depends on you what you want to keep in the application name.

There is one more way to install it the Laravel installer. To install Laravel through its installer, run the below command in the git bash that would add global composer dependency.

composer global require laravel/installer

After running the above command, we can install the Laravel application by the following the command,

laravel new this-is-your-application-name

Again, the last part of the above command is the application name which can be changed. Sometimes, it takes a few seconds to complete so wait for it in case it takes time.

Once the installation is completed then run below to get inside Laravel in the git bash,

cd this-is-your-application-name

Then run the below command that would serve the Laravel application on the local server,

php artisan serve

Next, generate the app key for the newly installed application.

Conclusion:

The following steps have been covered in this article,

  • Required software for installation of Laravel application
  • Brief introduction of each software and installation guide
  • Laravel installation steps through composer
  • Laravel installation steps through its installer