In this post, I will share on how to install Laravel Framework on our local machine (PC/Laptop).
Step 1: Install Web Server
You can download any third-party web server such as XAMPP, WAMP or MAMP
Download from their official website:
XAMPP - https://www.apachefriends.org/download.html
WAMP - https://www.wampserver.com/en/download-wampserver-64bits/
MAMP - https://www.mamp.info/en/downloads/
After successfully installed, you can start your webserver.
To make sure that your web server has started, you can open your browser, and go to http://localhost.
A web server homepage will be shown.
Step 2: Install Composer
Composer is a PHP dependency manager. Why we should use composer? Because it's easier for us to install any packages later.
Download composer from their official website:
https://getcomposer.org/download/
Once composer has been successfully installed, you can open your terminal, and type "composer".
If you get this message, congratz! Your composer has been successfully installed!
Step 3: Install Laravel
Open Laravel Official Documentation at https://laravel.com/docs/10.x
Check the requirements https://laravel.com/docs/10.x/deployment#server-requirements
As you can see, Laravel version 10 will require PHP version 8.1 and above.
You can check your local machine PHP version first.
Open your terminal, and type "php -v"
In my case, my local machine has PHP version 7.4.21
Which means, I cannot install Laravel version 10 on my local machine.
But I do have an alternative to install an older version of Laravel, which is version 8.
After you have confirmed your version, open your terminal, and go to your web server root directory.
In my case, my root directory located at /Applications/MAMP/htdocs
Yours might be different.
After that, just type this command
composer create-project laravel/laravel:^8.0 example-app
With this command, you will install Laravel version 8 via composer.
"example-app" is folder name. You can replace it with your own preference folder name.
Voila! You have successfully installed Laravel Framework on your local machine!
Step 4: Start Development Server
At this point, you already have Laravel Framework installed on your local machine.
A final step will be to start the development server.
On your terminal, go to your Laravel project directory.
In my case, my project directory located at /Applications/MAMP/htdocs/example-app
Then just type this command:
php artisan serve
This command will start the development server for you.
Then, open your browser, and go to http://localhost:8000
Congratulations! Laravel application has been installed and running on your local machine!
