How to Install Laravel on Windows 10 - Courseya

Laravel one of the great PHP framework to build web applications released the new version which is Laravel 7 on March 3rd, 2020. They usually release the major versions every 6 months.
If you are interested to know the version releases of Laravel, the below table will benefit you.
You can see that an LTS(Long Term Support) version is released by Laravel in September 2019. A lot of improvements are made in Laravel 7 compared to the Laravel 6 LTS.
  • Laravel Airlock
  • Custom Eloquent Casts
  • Blade Component Tags & Improvements
  • HTTP Client
  • Fluent String Operations
  • Route Model Binding Improvements
  • Multiple Mail Drivers
  • CORS Support
  • Query Time Casts
  • MySQL 8+ Database Queue Improvements
  • Artisan test Command
  • Markdown Mail Template Improvements
  • Stub Customization
  • Queue maxExceptions Configuration
I am not explaining more about these features in this article and if you would like to know those, please refer to the official release notes of Laravel 7.
So let us learn the steps for installing Laravel 7 on Windows 10 using XAMPP.

Installation steps

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.
First, download the XAMPP from the official website that I have given below.
https://www.apachefriends.org/download.html
Laravel 7 requires PHP >= 7.2.5. So download the latest version (7.3.3/PHP 7.3.3).
I have explained the XAMPP installation steps with the screenshots.
1. Select the components to install with XAMPP. Actually we only need Apache, MySQL, and phpMyAdmin. But here, I have selected all.
2. Select the installation folder. In default, it will be C:\xampp
3. So we have successfully installed Apache and MySQL. Now start the Apache and MySQL.

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 the composer before installing Laravel. Just follow the below URL and download the Composer-Setup.exe file.
https://getcomposer.org/download/
Image is loading...
I have shown some screenshots of the installation steps.
Image is loading...
Image is loading...

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

4. Creating a New Application

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

5. 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).
Now you can see phpMyAdmin panel where you can manage all the MySQL databases.
To create a database by clicking New from the left menu. Enter the database name and press Create.
  • Click on the New tab
  • Enter a database name
  • Press Create
Image is loading...

6. Modify .env File

So we have created the database successfully. Now open the Laravel app we have created in any editor. I recommend using Visual Studio code as the source-code editor for working with Laravel projects.
We can see a .env file inside the root directory of our project. Add our database details in this file which I have shown 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...

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

8. 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.
http://localhost:8000
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
http://localhost:9000

Summary

So, here in this article, we learned to install Laravel 7 on Windows 10 using XAMPP. I have also added some screenshots that help you with the installation procedure.
Share To:

Post A Comment:

0 comments so far,add yours