What is Laravel?
Laravel is PHP framework, which is easy to understand and robust and open source also. It also offer the rich set of functionalities that incorporates the basic features of PHP framework such as Codelgniter, yii, and other programming languages like Ruby on Rails. It is a PHP framework that uses the MVC architecture.
MVC vs NON-MVC:
Let’s first understand the MVC architecture.
MVC stands for Model-View Controller. It is a software design pattern by which creation of huge applications becomes easy. It does not belong to specific programming language or framework, but it is a concept that you can use creating any kind of application or software in any programming language.
Easy to update the application.
Easy for the developers to collaborate and wor together.
East to debug because of multilevel properly written application.
Development becomes fast.
MVC architecture is little bit difficult to understand.
Setting up laravel project:
How to set up a Laravel Project
Setting up laravel project is very easy task.
First we need to install composer and xampp in our system. The open command prompt in xampp\htdocs file.
Install laravel there. The command to install laravel is – composer global require “laravel/installer=~1.1” (NOTE= 1.1 is a larvael version)
After installation of laravel we need to create a project. The command to a create project is- composer create-project—prefer-dist laravel/laravel blog”5.8.*” (NOTE: blog is name of the project, so we can give any name.)
Understanding the folder structure:
After the laravel project is created, different types of files and folders are created. All the files and folder help us in writing codes
List of folders created:
1. APP:- The app directory contains the base code of the application.
2. Bootstrap:- The bootstrap directory containd all the app.php files and bootstrapping scripts uded for the application. In this directory there is cache directory which contains framework generated files for performance optimization such as the route and services cache files.
3.Config:- As the name implies, this directory contains all the configuration files.
4. Database:- Database directory contains all the Database files.
7.Routes:-In routes directory all the laravel routes are defined in routes file. It contain the definition files for routing such as api.php, wed.php etc.
8. Storage:- The storage directory contains file based sessions, file caches, compiled blade templates and many other files which are created by the framework. This is segregated into framework, app and logs directories.
9. Tests:- Test directories holds all the test cases.
10. Vendor:- The vendor directory holds all composer dependency files.
A Quick intro to the Artisian Command line Interface
Artisian is a command line interface which is frequently used in laravel and it have set of helpful commands for developing a web application.
Few commands of Artisian:-
- php artisian server (To start Laravel project)
- php artisian route:cache (To enable caching mechanism)
- php artisian list (To view the lit of available commands supported by Artisian)
- php artisian help serve (to view help about any command and view the available options and arguments)