DEV Community

Cover image for Install Laravel In a Fresh Windows Computer
Mahmudul Hasan
Mahmudul Hasan

Posted on • Updated on

Install Laravel In a Fresh Windows Computer

What is Laravel

Laravel is a PHP framework. Learn more from Laravel Official Doc

Install Laravel / Get Started with Laravel

Laravel is a PHP framework and PHP is a language that is used for backend development purposes only.

Unlike JavaScript, which is run on the browser, or on node.js which need to be installed on the computer. All modern browsers have a JavaScript engine like Chrome has V8. So to run JavaScript or get started with JavaScript language we need a browser or Node JS installed.

But PHP runs only on the server, which needs to have server software like Nginx or Apache. Our computer, which is not for server purposes use, does not have any server software, so to run or get started with PHP-Laravel we need to have Nginx or Apache server + We also need to have a Database client like MySQL or PostgreSQL or any other DB system for data storage.

All of this software and more comes with useful Laragon software which gives us a WAMP stack local server environment.

But, Before That

Before installing Laravel we need to have installed and configured both PHP latest version and Composer

Download PHP and configure

  1. For Windows we need to download thread safe zip file from the official PHP website Download PHP 8.2 Download Thread safe PHP 8.2 for Windows OS
  2. Unzip downloaded file
  3. Put this unzip file into C Drive > Program file
  4. Copy that folder path C:\Program Files\php-8.2.9-Win32-vs16-x64 Copy PHP folder path
  5. Search in the Windows console as Edit the system environment variable, it will open the system properties window Search Environment variable in Windows command prompt
  6. Then Click Environment variable Click Environment Variable
  7. In the below system variable section click the path option System variable
  8. Then click New and put that php path link C:\Program Files\php-8.2.9-Win32-vs16-x64 Paste the PHP folder path in the Environment variable
  9. Press Ok Ok Ok and close all windows.

Install Composer

  • Download Composer from official website and Install Composer
  • Download this Composer-Setup.exe file Composer Setup File
  • When Installing it will automatically detect our PHP file path Composer detects PHP path automatically

Install Laragon

Install Laragon is easy but, keep in mind, install Laragon in D/F Drive, except C drive. If you face any problem with Windows later, then you need to install Windows, and then all of your projects in Laragon will gone!

Download and configure PHPMyAdmin

After installing Laragon we need to download and configure the PHPMyAdmin MySQL DB console.

  • Download PHPMyAdmin MySQL from official website
  • Put this file into Laragon root www folder. You can go root folder in many ways Go Laragon www root folder from drive folder Or Go Laragon www root folder from Laragon console
  • Unzip the file and delete the zip file.
  • Rename this PHPMyAdmin file for shortcut use as pmad
  • Into the pmad folder, rename this config.sample.inc.php as config.inc.php
  • Open this file into vs code or any other code editor
  • line number 32, make it true Make The AllowNoPassword in config.inc.php true
  • After that we can get this PHPMyAdmin console from the browser
  • But before that, we need to press Stop & Start All Laragon all server and ports

Create Database in the PHPMyAdmin console

  • in browser write pmad.test and write username as root, then log in log into PHPMyAdmin console
  • Into the pmad console create a db project as you wish, we can write laravel Create a database table name as laravel in PHPMyAdmin console

Enable PHP essentials extensions

Now we need to enable some essential extensions in PHP, without those our Laravel project will not run. These are,

  • curl
  • fileinfo
  • mbstring
  • openssl
  • pdo_mysql

and more

Go to PHP folder > open php.ini file into code editor > enable these extensions

Install Laravel with Laragon Console

Go ⟶ Menu ⟶ Quick App ⟶ Laravel ⟶ Give name ⟶ Project created

Install by Laragon

Install with Composer

Laravel uses Composer for dependencies, just like JavaScript uses Node for dependencies. For installing any packages or extensions in PHP-Laravel we need Composer, like npm for node/JavScript language.

  • Check composer in command prompt: composer -v

If Composer is not updated then run the update command

  • Update composer: composer self-update --preview

  • Finally Create a Laravel project with the composer in the Laragon root folder

composer create-project --prefer-dist laravel/laravel myApp
Enter fullscreen mode Exit fullscreen mode

Install with Laravel CLI

Installing Laravel with Laravel CLI is so easy and simple.

  • First run this command in Laragon root folder composer global require laravel/installer
  • Then simply install Laravel project by running command laravel new myApp

After Laravel Install

After installing Laravel we need to configure env file in Laravel

  • Copy .env.example and paste a new file as .env
  • Now we need to put our DataBase Name, pmad console username and password in .env file
  • After that we need to have our project APP_KEY, run Laravel command php artisan key:generate Configure Laravel .env
  • After that need to migrate our PHP table into the Database console, run the command php artisan migrate
  • And Finally we need to open our Installed Laravel project in the browser as php artisan serve

If you face any problems, email me at mhasan.meet@gmail.com

Top comments (0)