All Tutorials

Your One-Stop Destination for Learning and Growth

How to Install Laravel 5.7 on XAMPP (Windows)

Laravel is a popular PHP web application framework known for its elegant syntax and beautiful default designs. In this tutorial, we will walk through the process of installing Laravel 5.7 on XAMPP for Windows users. Before we begin, ensure you have the following prerequisites:

  1. XAMPP: Download and install XAMPP from the Apache Friends website. Make sure to choose the correct version for your Windows OS.
  2. PHP: Laravel is built using PHP, so it's important that PHP is installed on your system as part of XAMPP.
  3. Command Prompt: We will use the Command Prompt for installing Composer and Laravel via the terminal.

Step 1: Enable PHP and APACHE

Once you have successfully installed XAMPP, open it and ensure Apache and PHP are enabled. You can check this by looking for the green dots in the XAMPP control panel as shown below:

XAMPP Control Panel

Step 2: Install Composer

Composer is a dependency manager used to manage Laravel's libraries. We will now install it using XAMPP's terminal.

  1. Open the Command Prompt, go to the XAMPP installation directory, and navigate to xampp\bin.
  2. Type the following command and press Enter: php install composer-global.phar
  3. Once Composer is installed, check its version by typing: composer -V

Step 3: Install Laravel via Composer

Now we will create a new Laravel project using Composer.

  1. Navigate to the htdocs directory of your XAMPP installation and open Command Prompt there: cd xampp\htdocs.
  2. Type the following command, replacing "projectName" with the desired name for your Laravel application: composer create --prefer-source laravel/laravel projectName
  3. After a few minutes, Laravel will be installed in a new directory named projectName.

Step 4: Install Laravel's Serving Tool (Valet)

Laravel's Serving tool, Valet, makes serving Laravel applications simple by automatically providing a web server on port 80. To install it:

  1. Open the terminal and type: composer global require laravel/valet
  2. Restart your Command Prompt window or open a new one for the changes to take effect.
  3. Enable Valet by typing: valet install
  4. Once Valet is installed, you should see a message stating that it's ready to use.

Step 5: Accessing Laravel Application

Access your Laravel application by typing projectName.test (replace "projectName" with the name of your application) in your web browser. You should now be able to view your newly created Laravel 5.7 application on XAMPP for Windows.

Published September, 2018