Laravel is a PHP framework which makes building complex web applications a cakewalk. In this guide you are going to learn how to Install and Configure Laravel and get your first Laravel project running in your computer.
- Basic knowledge of PHP
- PHP Installation
- Basic knowledge of Terminal/Command Prompt
Steps to install Laravel:
- Laravel actually uses a dependency manager tool called Composer to install all required libraries to run Laravel. So before we move forward make sure that composer is installed in your system. You can easily install Composer from here. It is well documented and after installation run the below given command in your terminal/command promt:
If it gives a output like given below then it means installation was successful and we can go to the next step.
- Next step is to create a folder where we are going to create our new Laravel Project. After moving to that folder just run this composer command to create a new Laravel Project.
composer create-project --prefer-dist laravel/laravel my-first-laravel-project
Here, create-project is a composer command which is just downloading the package and installing all the dependencies further needed by this package and then we have this –prefer-dist which means just prefer the stable version releases if possible, next we mention name of package which is laravel/laravel and my-first-laravel-project is actually the name of project folder and you can replace it with any name that you want. This will start the installation of all dependencies as given in the image below.
If everything went well then end of this script will look like this:
- Now you have a new folder called my-first-laravel-project and move to that folder. You will notice that inside this folder a lot of files and folders are already present, this is actually the Laravel framework itself. In this folder, run the command given below to start the in-build PHP server.
php artisan serve
This will give an output like given below:
Note: The link really depends on your system, it can be http://localhost:8000 also.
- Copy this link and open it in your browser to see your Laravel app (In my case it is http://127.0.0.1:8000). It will look like this: