How to Install laravel 5.7 in Windows, Mac and Linux

How to Install laravel 5.7 in Windows, Mac and Linux

So you have studied and learned your basic php, MySQL, HTML and CSS. You are comfortable with what you know and now you want to tame the Dragon.


  1. Introduction
  2. Laravel 5.7 requirements
  3. What is Composer
  4. Create a Virtual Host
  5. Laravel installation process
  6. Understanding the commands
  7. Additional Tips

1. Introduction to Laravel Installation

You went to Laravel website but you couldn’t see a download link like you use to see in WordPress website. Now you are really confused on how to even get started. I was there once and after spending sometimes on web, I was able to understand how things really work around. Now without any delay, I will show you how you can install Laravel 5.7 on any system. Before we proceed, lets check what are the system requirements.

2. Laravel 5.7 System Requirements:

  1. PHP >= 7.1.3
  2. OpenSSL PHP Extension
  3. PDO PHP Extension
  4. Mbstring PHP Extension
  5. Tokenizer PHP Extension
  6. XML PHP Extension
  7. Ctype PHP Extension
  8. JSON PHP Extension
  9. BCMath PHP Extension
  10. Composer
  11. Git (for windows, it makes command line work easier)
  12. And willingness to think out of box and be open minded

Before we start, let’s make sure we have requirement 1 to 9 installed in our system. For that, we will install XAMPP which will sort out all of the mentioned requirements. You can download XAMPP from this link .

Now, if you are on windows, its better if you have git client, in order to get git for your Windows or Mac or Linux, visit this link

Now, you have all the requirements sorted except 1, Composer but what exactly is composer? Lets do a crash course.

3. What is Composer?

According to Composer documentation, “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”. Now, when I read that for the first time, it flew miles over my head, so let me list what it is and what it does in bullet points, so you will have the basic understanding.

  • Composer is Dependency manager tool for PHP
  • Composer helps you to install third party libraries (packages) that you may require on your project.
  • It helps you to uninstall unnecessary packages that you may have tried before, saving you enormous amount of headache.
  • It will allow you to install Laravel and update it when new version is released
  • It will also all you to update packages that you are using in your application without ever clicking on download button.
  • Composer runs through command line interface, that’s why we downloaded and installed git, although you can use Command Prompt, I prefer this method.

Now, I believe you understand why we don’t need the “download Laravel” link and how we are going to manage our Laravel installation, move ahead.

4. Creating Virtual Host

Firstly, lets create a virtual host where we can define a separate folder named “myapp” for our Laravel installation and give it a virtual domain and call it “myapp.local”. So, instead of typing localhost, you will type myapp.local to open your Laravel project. If you don’t know how to create a virtual host, follow this tutorial where I explain how to create Virtual Host.

Now, time for us to fire up XAMPP. Once the XAMPP is up and running, open terminal in linux(/opt/lampp/htdocs) and mac(/Applications/XAMPP/htdocs) and navigate to htdocs folder of XAMPP. For windows, go to C:/windows/htdocs/ and right click on empty space and click on “Git Bash Here”.

5. Laravel Installation Process

After that, we will type the composer create-project command like below

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

Here, we are asking composer to create new project with “composer create-project” and asking composer to download Laravel, using  Laravel’s package name in, you will many packages in packagist which you can pull with composer. so the explanation of command is as follows,

6. What does the command means?

Composer: starting composer

Create-project: asking composer to create new project

–prefer-dist: asking composer to download the preferred distribution(stable) of Laravel

laravel/laravel: package name in

myapp: folder where composer should create(if it doesn’t exist) and install Laravel.

Depending on your time. It start downloading and you will see what packages it is pulling. It will take some time to finish download. Once everything done. You can visit myapp.local on your browser and folders out of those folders, click on public and you will see your shiny new Laravel installation.

7. Additional Tips

If you want your Laravel project to appear once you type myapp.local instead of myapp.local/public, make sure you add “public” at the end of DocumentRoot "C:/xampp/htdocs/myapp" in httpd-vhosts.conf while creating virtual host. It should look like DocumentRoot  Read this to understand better. If you run into No application encryption key error, check this out to sort it out

How to Install laravel 5.7 in Windows, Mac and Linux 1