In this post, we will install Laravel 8 on Windows operating system.
Requirements to Install Laravel
Before moving to the Laravel installation, we have to make sure that our machine fulfills all the requirements of the Laravel framework and make sure your machine meets the following system requirements:
- A webserver Apache or Nginx
- PHP >= 7.1.3
- OpenSSL PHP Extension
- PDO PHP Extension
- Ctype PHP Extension
- JSON PHP Extension
- MBString PHP Extension
- Tokernizer PHP Extension
- XML PHP Extension
- BCMAth PHP Extension
- Composer
If you are using any WAMP, XAMP or Laragon application on your machine then most probably you will have all the above requirements installed on your machine except Composer.
Heads Up! Laravel 11 is coming soon
Head here for more information on Laravel 11.
What is Composer?
Composer is a dependency management tool that allows us to manage and control the dependencies of our PHP based applications. Composer is an Open Source application and FREE to the user.
Download and Install Composer in Windows
Before installing Composer, please make sure you have the PHP and MySQL installed on the computer and it’s working. To check this open the command line terminal (Git Bash or Windows Command Terminal) and run the below command.
php -v
If the PHP is installed and running properly, then you will have output something like below.
PHP 7.4.19 (cli) (built: May 6 2021 13:25:24) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
Next, we will download the latest version of
Composer for Windows
from the official website. On the Composer’s website’s Download section you will get the link to download the Composer-Setup.exe file.The file size of this installation file is very small, once you have downloaded the file head over to the next step.
You will need to run the Composer’s installation file as any Adminstrator if you are on a shared network. Right-click on the file and choose Run as Adminstrator.
You will have the installation window open like below simply, click on Next.
Next, the installation will automatically locate the PHP installed on your computer, simply press Next.
Next, it will ask you for any proxy settings, simply press Next.
Now, the composer is ready to install, click on Install button and composer will be installed on your computer.
When the installation finish, open the command line terminal and run the composer
in it. If the composer has successfully installed, you will get the output as below.
Now, we’ll be moving to the process of Laravel download and install.
Creating New Laravel Project using Composer
Open the command line terminal such as Git Bash or PowerShell of windows and run the below command to create a new Laravel 6 application.
composer create-project --prefer-dist laravel/laravel laravel-app
This process will take some time to install all dependencies and libraries. You will have output some like below.
Wait, until the process completes.
How to Run the Laravel Application
Once, the Laravel project is created you can start developing the next awesome application. Within the command line terminal run
cd laravel-app
to move inside the project folder.
You can use any code editor such as Sublime, VS Code or PHPStorm. I recommend you to use the VS Code.
On command line you can start the in-built PHP server to run the Laravel application. Open the command line terminal and run the below command.
php artisan serve
The above command will start the Laravel development server. After that, open your browser and access the project by visiting the localhost:8000
in your browser window.