Before installing Laravel, it is important for you to install Composer on your system. Laravel, in fact, uses Composer to manage dependencies. Similarly, you also need to install Xampp to install Laravel on the localhost. In this chapter, we will only cover the installation of Laravel.
Laravel installation requires quite a few steps. First of all, go to https://getcomposer.org/download/ to download Composer exe file. Subsequently, click on the exe file and install Composer just like any other program.
Once you have installed Composer, type the following command in Command Prompt and press Enter.
If you see the following outcome, you have successfully installed Composer on your system.
Now, type the following command to install Laravel on localhost that is XAMPP in our case.
C:\>cd xampp C:\xampp>cd htdocs C:\xampp\htdocs>
Now, you have to write the following command in the corresponding path to launch a new Laravel project.
C:\xampp\htdocs>Composer create-project --prefer-dist laravel/laravel new_project
The Laravel will start installing on your computer once you execute this command.
Execute the PHP artisan serve command in the new_project folder after the installation of Laravel is complete by writing the following commands.
C:\xampp\htdocs>cd new_project C:\xampp\htdocs>new_project>php artisan serve
Now, you do not need to do anything on the command prompt.
Launch XAMPP and go to its dashboard which looks like following.
You have to start both Apache and MySQL services in the XAMPP control panel. They will turn green when they start successfully as the above image shows.
It is now time to open your browser and write any of the following addresses in it.
If you get the following result, you have successfully started your new Laravel project. Now, you can start developing web applications in Laravel without any further delay.
In the next lesson, we will learn more about PHP Artisan commands in Laravel.