Introduction to Laravel and Composer
Because it is not easy to install into a computer like other PHP frameworks like CodeIgniter. In CodeIgniter, we simply download the CodeIgniter folder and run it in localhost.
We all know Laravel is an MVC framework and it offers a robust set of tools and application architecture. It is an open-source PHP framework and it offers very robust features for boosting the speed of web development. If you know core PHP, then you can easily understand the flow of this framework.
Laravel manages dependencies, and it uses Composer to manage its dependencies.
Downloading and Installing Composer
So, for installing Laravel, we want to first install Composer, which is a PHP dependency manager. By using this software, we can install the Laravel framework and we can run a Laravel application in our localhost. So, first we have to download Composer software. To download this software, first, we have to go to this website and from this site, we have to download this composer software.
After downloading this software, now we have to install this software in our computer by running this executable file. Here, we want to select where we have installed our PHP software. So, here we have installed our PHP server in the F drive, so we have selected this drive. So, you have to select that drive where you have installed your PHP server. After selecting that, now we have to press next. By selecting that, now we can execute PHP files from anywhere in our computer.
So, this way we can install Composer software in our computer. By using this software, we can download a Laravel application and run that application in the browser.
Preparing the Project Directory via Command Line
Now, we want to run the Composer software. So, we have to open the command prompt and after this, here we have to write the composer command. After writing that command, it will load the Composer software commands on screen.
Now, here we want to create one folder in which we want to download the Laravel application. So, here we have written F drive, in which we want to download the Laravel application. After coming into this drive, now we want to go into this drive. So, we have to write the change directory command with the folder path. By using this command, we can go into a particular folder.
Under this folder, we want to create one folder with the name Laravel-crud. So, here we have to write the make directory command with the folder name Laravel-crud. By using this command, we have made this folder.
Creating a New Laravel Project with Composer
Now, here we have to type a command like composer create-project laravel/laravel --prefer-dist.
This command will create the folder and under this, it will download the Laravel application. It will take around 5 to 10 minutes to download the Laravel application. Here, we can see the download process. It has downloaded all Laravel application dependency files from their respective servers to our local folder.
After completing the download process, so here we can see the Laravel-crud folder in our local directory. And in which we can see the Laravel folder in which the whole Laravel application has been downloaded.
Exploring the Laravel Directory Structure
Now, we can see the root directory of the Laravel application. Here, first is the app folder, and under this directory is stored the core code of the application.
Second folder is bootstrap, and in this directory is stored the application bootstrapping script.
Below the bootstrap folder, we can see the config folder, and under this directory, it stores configuration files for the application.
Fourth folder is the database folder, and under this folder, it stores our database migrations and seeds.
After this, we can see the public folder, and this is our application's root directory. From this directory, it starts the Laravel application, and under this directory, we can also find application assets like JavaScript, CSS, and images also.
Below the public directory, we can see the resources directory, and under this directory, we can see raw assets of the application like LESS and CSS files, language files, and HTML templates also.
After this, we can see the storage directory, and under this, we can store application storage like file uploads.
Below this, we can see the test directory, and this directory contains various test cases.
Lastly, we can see the vendor directory, and this directory contains Composer dependencies.
So, this is a short description of the Laravel directory structure.
Running the Application with Artisan Serve
Now, we want to run the Laravel application. So, we go to the command prompt and here we type a command like php artisan serve and press enter.
After pressing enter, we can see a message like 'Laravel development server started' and we can also see a new URL on screen also. So, we copy this URL and paste it into the browser and press enter.
So, here we can see the Laravel framework welcome page on the web page. So, this way we can run a Laravel application.
Conclusion and Next Steps
So, in this part, we have discussed how to install Composer software, and then after, we have downloaded the Laravel application by using Composer software. After downloading the Laravel application, we have discussed the directory structure of this framework, and lastly, we have seen how to run the Laravel application.
Now, in the next part, we will discuss how to make a database connection and how to make a simple database table in the Laravel framework.
If you have any query regarding this video tutorial part, please comment your query in the comment box. And if you like this video tutorial, please share it with your friends or you can also share it on social media also. If you want to get more updates regarding our video tutorials, please subscribe to our YouTube channel to get more updates regarding the release of future videos. Lastly, keep watching our YouTube channel. Thanks for watching.