Welcome and Overview
Hi everyone, welcome back to my channel. My name is Anil and in this Laravel video tutorial we will learn how we can install the Laravel. There is a two way to install the Laravel: one with the Laravel installer and another one is with the composer create project. We will see both of the way in this video, right. So one more thing that in the last of this video I will ask you the intro question which is very important for you. Please attempt this question in the comment box and that's okay if you just don't want to attempt this question but just read about this intro question on the internet or ask me on the comment box if you don't know the answer of this question, right?
Prerequisites: PHP and Composer
So before just starting with that I'm just going to tell you that you need to think to install the Laravel one is PHP and another one is the Composer. Right. So we are just talking about the Laravel 8, that means you need a PHP 7.3 version or it's a latest version, right. So let's check out the PHP version here. php -v. My current version is PHP 7.4.4, right. So if you have lower than that, PHP 7.3, then you have to just update your version. Otherwise that's okay if you have greater than or 7.3, right. Second thing is Composer which is a very important thing again. If you don't know what is the Composer and how we can install it then link is given in the description box. Just find out the link and just read about the Composer because this is a very important thing when you just start with a Laravel framework, right.
Installer vs Composer Create-Project
So everything is fine, everything is installed now. Let's just go to the official documentation for some moment and here you can see that there is also two way to install the Laravel as I told you: the Laravel installer and second one with the composer create project. When you use the Laravel installer then first of all you need to install the Laravel installer right with this command. You need to just run this command only once on your operating system and in any folder wherever you want on a root or any specific directory. You just need to install it like first time like installing the VLC player or installing the Chrome browser simply, right. And after that again when you just want to create a project then you need to run this command. I will show you every each and every step. But first of all I just want to go through the steps, right. So this is one way to install the Laravel and second one is that you can use the composer create project and your project name with the Laravel, right. So we will see both of way. So first of all let's check out with the installer. Let's open your command line. I already have installed the Laravel here you can see that, but I will install again so that you just get to know that how we can install it.
Installing and Using the Laravel Installer
So just need to put here composer and then global required laravel/installer, right, and just hit the enter. Keep in mind again I'm just saying again and again because in the last series when I just make about the series Laravel 6 and 7 people just ask me that do I need to run this command every time? No, you just need to run this command only once. Whenever your Laravel installer is done then you need to run this command every time for creating the new project, right, or you can use the second way here you can just you need to only single command. There is a node to command or thing, right. So now you can see that Laravel installer is installed. When you just write here laravel and you will find out the old details like Laravel version and commands. So here you can see that laravel new is a command to create a new Laravel application, right. So I am just going in the dashboard and ate this my folder name and just write here laravel new and your project name, right. So let's say my project name is blog and just hit the enter, right. So it will just take some moment to install the Laravel.
Verifying the Installation with Artisan Serve
Yeah, within that I'm just going to show you the folder name. This is my folder where we are just creating this Laravel and this is my composer.json file. Every details of my project will be actually mentioned here. Let me just open it in some editor like Visual Studio so that I can show you. That's why Composer is very important. If you don't know about this as I already told you link is given in the description box, right. Okay, so it will I think this the file is actually opening and here you can see that Laravel project is installed here. So just write here php, go to the blog folder and this right here php artisan serve and let's see that this is working or not, right. So just simply go on the localhost and here the Laravel project is running fine, right. And let's open this project inside the code editor also now. It actually open two thing but close let's one of them and again let's open the composer.json here you can see that Laravel it is installed. That version is actually looking for, right. So that is the one way to install and let's look out for the another way with the composer create project, right. So let's close the command line for a moment and just close the editor as well as let's delete this one right so we can we can just create a new one project.
Installing with Composer Create-Project
And now let's do the same thing. Just go to the folder with the dashboard Desktop then add folder and just simply write here composer create-project --prefer-dist laravel/laravel blog and just hit the enter, right. And if you just want to look at this command then you can just find this command on the official site also. Even this command also given in the description box, right. So it will just take a moment to install it.
Interview Question and Wrap-Up
Okay so now let's talk about my interview question as I told you in this video. Composer is a very important thing so my question is: what is the Composer and why we use it? So if you don't know the answer then just watch it on the internet or my previous video and if you just want then you can comment the answer so that other guys can also read this answer, right. And if you don't want to just make it comment then please just get to know about this because really this is a very important question in the interview. So here you can see that we are about to install the Laravel 8 with the another way also, right, and now let's go to the again blog folder and just write here php artisan — oh sorry my bad I have to go to the folder then just write here php artisan serve and again it will be run on the same port. Here you can see that everything is working fine, right. So I told you about both of the ways to install it and in the next video we will just look out the file and folder structure of the Laravel which is again very important thing so don't miss any video. I plan to make around 100 video on the Laravel in the upcoming one or two months so bye bye, take care for a moment and yeah don't forget to subscribe my channel. Bye.