why we need xampp to run laravel code example

Example: how to run laravel project in xampp

Install XAMPP
Install composer(You can download composer from https://getcomposer.org/download/)
Open cmd(make sure your path is the same as C:\xampp\htdocs>) then
Install laravel GLOBALLY by the command: composer global require laravel/installer
Now hit the command: laravel new your-projectname
Your project is created now to run the project use command: php artisan serve
The URL will be displayed on cmd, copy and use that URL in a browser you can see your laravel project
                 
/*If you have a ready project and you want to run with XAMPP*/
if your laravel project is ready then put a laravel project folder at htdocs(unzip if it's .zip file)
Create a database(you can see database name in .env file) then select the created database and import the .sql file(if .sql file is not provided then you have to create an entire database).
Now your project is ready to run.
Start the Apache and MySQL from XAMPP then hit the php artisan serve command in cmd(make sure your cmd is opened with the same path as your project).