How to Install Laravel 5.6 on Windows using Composer

On 6/19/2018

Here let's see how to install laravel on windows using composer. Ever since its launch, laravel has become the most popular php framework and not without a good reason. It's a great alternative to CodeIgniter which is another popular MVC for php. Laravel ships with so many goodies out of the box than other frameworks do.

Mastering laravel will definitely take some time, but the time spent is well worth it in the long run. And it will save loads of time in application development. Anyhow, here you are, planned to move on to laravel and want to install it for the first time. Without wasting the time, let's dive into the process of installing laravel on windows machine.

step by step install laravel on windows composer

System Requirements for Laravel:

As of now, the latest laravel version is 5.6. And you have to make sure the below system requirements is met to install and use it on your machine.

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

Reference: Laravel website

Prerequisite: Composer

Laravel requires Composer to manage the project dependencies. So before installing Laravel, make sure you have Composer installed on your system. In case you are hearing about Composer for the first time, it's a dependency management tool for php similar to node's npm.

To install Composer on your machine, check this post:

Installing Laravel on Windows:

Follow the below steps to install laravel on windows machine. No matter you have xampp/wamp stack, it works for both. On WAMP, make sure to install laravel on 'www' folder and on XAMPP, obviously the 'htdocs'.

STEP-1) Open 'htdocs' folder on XAMPP, hold SHIFT key and right click on the folder, and choose 'open command window here'. Alternatively, you can open command window and change directory to 'xampp/htdocs'.

STEP-2) Enter the following command.

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

Here 'my_laravel_site' is the folder name where laravel files will be installed. Change this to your liking.

STEP-3) Now it's time to be patient as laravel installation is going to take some time.

STEP-4) Once installed, change directory to 'my_laravel_site' (cd 'my_laravel_site') on the command prompt and enter the below command.

php artisan serve

STEP-5) This will show a message something like, 'Laravel development server started:' along with an url.

STEP-6) Copy and paste the url on the browser. If things go right, you'd see the laravel welcome screen.

laravel welcome screen

STEP-7) Done! You have successfully installed laravel on windows machine and ready to go with.

Setting Application Key:

Laravel requires little configuration after installation. It requires you to set the application key. This is a random string of 32 characters long used for encrypting session and other sensitive data. Usually this will be set automatically when you install laravel via composer or laravel installer.

In case it's not set, you have to do it manually. First make sure to rename the '.env.example' file to '.env' on your application root. Then open command prompt and change to the laravel project folder. Now run the below command to generate the key.

php artisan key:generate

Copy this generated key to the APP_KEY variable on '.env' file. Save and you are done.

Installing Specific Laravel Version:

The above given method will make composer to download and install the latest version of laravel. If you want to install earlier versions of laravel on your machine, make sure to include the respective version number on create-project command.

composer create-project laravel/laravel=5.4 your-project-name --prefer-dist
Read Also:

Likewise you can easily install laravel using composer on windows. I hope you find this tutorial useful. Please share it on your social circle if you like it.

1 comment:

  1. very informative post. please provide us more on the same


Contact Form


Email *

Message *