You will be shown how to set up a Laravel project on a local server using the Xampp development stack on a PC.
Xampp is a free and open-source cross-platform web service stack package. It is used by developers to launch PHP projects such as Laravel on their local computer in order to create and test programs locally.
Step 1. dowload Xampp
Go to this website https://www.apachefriends.org/download.html and dowload Xampp PHP version 8.
Step 2. Install Xampp to your PC.
Double click on the Xampp installer that was downloaded and it should launch a wizard.
The default setup is normally recommended. Therefore, continually click next in each step until the wizard start installing all the packages.
Step 3. Install Laravel to Xampp.
Once the download is successful, there should be a Xampp folder in your C drive.
Please be sure to have composer installed globally on your PC for this step. Here is a tutorial on how to install Composer "https://wecode101.com/install-composer-on-windows-10". Otherwise, if you already have a Laravel project on your PC, copy and paste the project in "C:\xampp\htdocs".
Open your command prompt terminal and cd to the "xampp/htdocs" folder. Run this command "composer create-project laravel/laravel example-app" .
example-app is the name on the project so you can change that to whatever name you desire.
Step 4. Start the Xampp servers
Launch the Xampp Control Panel via the Xampp app icon. If you cannot see the Xampp app icon just search for it in Windows search feature. Once the control panel is launched, click on the Apache and MySql start buttons. If port 80 and port 3306 are not available, you might get errors and the servers will not start.
Step 5. Create database on server.
Once Apache and MySql as started successfully open a browser such as chrome, copy and paste the url "http://localhost/dashboard/" then click on the phpMyAdmin tab. You should see the phpMyAdmin panel, click on the database tab in order to create a new database.
Step 6. Configure .env file to connect with Xampp database.
Go to your .env file and edit the database section as below:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1 DB_PORT=3306
DB_DATABASE=thexamppdatabasename
DB_USERNAME=root
DB_PASSWORD=
Step 7. launch project
Once all the steps are completed successfully launch the Laravel project in a browser "http://localhost/yourlaravelprojectname/public/". If you created the project from command line as in step 3 then your project name would be "example-app".