Introduction to Laravel

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.

Advantages:

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.

Disadvantages:

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

2. Bootstrap

3. Config

4.Database

5. Public

6.Resources

7.Routes

8. Storage

9. Tests

10. vendor

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.

5. Public:- In public directory contains the index.php file, which is the entry point for all request entering the application and configures the autoloading. This directory maintains all the other important files like  Javascript, CSS and images. 

6.Resources:- Resources directory contains the views and  un-compiled assets like CSS and JavaScript. It also contains language files, sas files and templetes(if any).

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:-

  1. php artisian server (To start Laravel project)
  2. php artisian route:cache (To enable caching mechanism)
  3. php artisian list (To view the lit of available commands supported by Artisian)
  4. php artisian help serve (to view help about any command and view the available options and arguments)

shashank K
Latest posts by shashank K (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x