Laravel and windows 10
|

How to Install and setup Laravel 5.8 On Windows 10

Laravel is one the popular PHP framework. It is Model-View-Controller (MVC) architecture-based framework. The MVC architecture and blade templating engine has made Laravel simple and Powerful. Here, we are going learn about the steps to install and set up the latest Laravel 5.8 version on Windows 10. The Laravel 5.8 requires php version PHP >= 7.1.3.

Laravel Installation Steps:

Install Xampp

XAMPP is the most popular PHP development environment and it is completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. It has been around for more than 10 years and has huge community behind it.  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 link below.

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

Steps to Install Xampp

Xampp for windows 10

Some screenshots of the installation steps below of xampp

Xampp setup steps
xampp setup steps

Start Apache and MYSQL

After successful installation of Xampp. Let’s run it and start apache server and MYSQL.

run Apache and MYSQL in Xampp

Install Composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

composer download

Install Laravel

After installing composer in windows machine. Now its time to install Laravel on our system using composer. This can be done by executing this command in the command prompt.

composer global require laravel/installer

Create New Laravel Application

After successful installation of Laravel, we can create a new app with the below command. If HelloWorld is the name of the project we want to create, we have to run following command in the command prompt.

composer create-project --prefer-dist laravel/laravel HelloWorld

or we can just run the below command if Laravel is installed globally in the machine.

laravel new HelloWorld

Create Database

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
  • Then enter username and password (As default, root will be a username and there will be no password.
  • Click on a new tab and create a database with database name.

Modify Env

The .env file is in the root directory of the project. Open the .env file and add our database detail as follows.

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)

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

Run Application

Our application can be run using the command below.

php artisan serve

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

Alternatively, we can run the service as follows.

php -S localhost:1212 -t public
or
php artisan serv --port=9000

This way we can completely setup a Laravel project in a windows 10 for the first time.

 Enjoy coding.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *