Patrick Lusaya
Posted on January 24, 2024
Welcome back to Laravel! Whether you're a beginner or a seasoned developer who's forgotten the basic setup, this quick guide will help you set up Laravel on Windows using XAMPP.
Follow me on twitter, I'll help you out with something ... I promise.
Lets get started
Step 1: Install PHP
First, you'll need PHP installed on your system. Laravel, being a PHP framework, requires PHP to function. You can download PHP from the official PHP website.
- Click on the Windows Download
- On the page where you are redirected, choose the thread-safe option and click on the zip link to download it.
- Once the zip file has been downloaded, extract it and copy the extracted folder into your program files folder located at
Local disk(C) -> Program files
- Now after pasting the folder, copy the its address.
- On the start menu search for "Edit the system environment variables". Press enter to open it. A new window will appear then click on the "Environment Variables: button.
- Another new window will appear and on the System Variables section, double-click on the Path to open up a new screen.
- On that new screen, click on the new button. A field will appear. Paste the address copied previously and press OK on all screens to save your changes.
To check if PHP is installed successfully, go to the start menu and open your terminal by typing cmd.
On the terminal type,
php -v
and press Enter to see the version of PHP installed.
Step 2: Install Composer
Composer is a dependency management tool for PHP which is required to install any PHP package/library you might want to use. Here's how to install it.
- Visit https://getcomposer.org/ and click on the DOWNLOAD button.
- You will be redirected to the download page where you will have to click on the Composer-Setup.exe to download Composer on your machine.
After the download is complete, Open the setup and select "install for all users"
For the next pop-up screens that appear click YES to allow installation then choose the installation type and press NEXT.
Select the command-line PHP path you want to use, check the box to add the PHP path, and click NEXT.
If you want to use a proxy, check the box and enter the proxy URL and if not proceed by clicking NEXT.
If everything seems okay, click the INSTALL button.
Read the information that follows after installation and click NEXT.
Finally, click the FINISH button to complete the installation.
Open your terminal and type "composer" to check if the installation was successful. If it was you will see the composer version and other composer commands
Step 3: Install XAMPP
- Visit here and click on the Xampp for Windows link to start the download.
Select MySQL, FileZilla ftp server, PHP, phpMyAdmin or you can just leave the default options and click the Next button.
In order to configure the htdocs folder for our apps, select the root directory path. Consider "C:\xampp."
To enable the XAMPP modules from the Windows firewall, click the Allow access button.
Click the XAMPP Setup wizard's Finish button after the installation is complete.
To start Xampp, go over to the start menu and type "xampp" then press enter to open it.
- To start the server, press the start button for Apache and Mysql, then the admin button of Mysql to open phpMyAdmin.
Now that you have PHP, Composer, and XAMPP installed, you can create a new Laravel project.
- Since you are using xampp, the laravel project you are going to create should be within the xampp's htdocs folder found at
C:\xampp\htdocs
.
- Open the terminal at that location (
C:\xampp\htdocs
) and run the command composer global require "laravel/installer"
to install laravel
Then run
laravel new my_app
on the same path (C:\xampp\htdocs
) to create a project called "my_app"Now go inside Laravel folder and run
php artisan serve
command.
- If everything goes well, the command will launch a local development server on port 8000. You can access your Laravel application by opening your web browser and navigating to http://localhost:8000.
That's it! You've now successfully set up Laravel on Windows using XAMPP.
If, I've just saved your day follow me on twitter and I'll save you another
Happy coding!
Posted on January 24, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.