Essential Requirements for Installing Laravel
Before diving into Laravel installation, it’s crucial to ensure you have the necessary tools and environment set up. Laravel is a powerful PHP framework that can help you build robust web applications, but it does require a few prerequisites. In this article, we’ll walk you through the essential requirements needed to get Laravel up and running on your local machine.
Requirements:
- XAMPP or any Web Server Solutions – Link
- Composer – Link
- Git Bash (Optional) – Link
- Visual Studio or any IDE/Code Editor – Link
Once we’ve got all the essential requirements in place, it’s time to roll up our sleeves and start building! In the next steps, we’ll guide you through creating and installing your first Laravel project. Lets start.
Open Gitbash or any terminal like command prompt. (Take note: Before proceeding to the next step, make sure you have Composer installed)
To create Laravel projects, you need to install the Laravel Installer by running the following command:
composer global require laravel/installer
After the installation is complete, Open your XAMPP and Start the Apache & MySQL.
To ensure that your XAMPP apache and MySQL are working, try to open or click the Admin next to the Start/Stop button in XAMPP Control Panel. Or you can visit the below link in the URL.
localhost/dashboard
If you can visit the link without encountering errors like “Refused to connect” or “Can’t be reached,” you’re on the right track. Otherwise, you’ll need to restart XAMPP and ensure both Apache and MySQL are turned on.
Now let’s try to create a project.
1. Choose the location where you want to place your Laravel project. I prefer using the Desktop, where I’ve created a “Projects” folder in the Desktop Directory. However, you can choose any location you prefer, but avoid the directories listed below:
/usr
/var
C:\Windows\System32
These directories are reserved for system files and may have restricted permissions, which can cause problems with file access or permissions when running your Laravel app.
2. Inside the folder that you created open gitbash or cmd there.
It will open a terminal.
3. In the terminal, Type the following:
laravel new <project-name>
This command will create your first project in laravel!!!
4. After the installation, type the following command:
cd <project-name>
code .
5. After typing the command “code .”, it will open up your visual studio.
6. Open again your gitbash, and type the following command:
php artisan serve
You can see your laravel application up and running in the following link http://127.0.0.1:8000
7. Open your browser. and paste or put the link in the url and Enter!
Then, voilà! Your Laravel application is ready, and you have created your first Laravel project. Happy Crafting!