Introduction – PHP Laravel Framework For Web Artisans

Introduction – Laravel – The PHP Framework For Web Artisans | what is laravel

Laravel is the most popular and powerful MVC framework which is used to develop complex web applications.It is a free and Open source PHP framework.

Laravel is an open-source PHP framework, which is robust and easy to understand. It follows a model-view-controller design pattern. Laravel reuses the existing components of different frameworks which helps in creating a web application. The web application thus designed is more structured and pragmatic.

Laravel offers a rich set of functionalities which incorporates the basic features of PHP frameworks like CodeIgniter, Yii and other programming languages like Ruby on Rails. Laravel has a very rich set of features which will boost the speed of web development.

If you are familiar with Core PHP and Advanced PHP, Laravel will make your task easier. It saves a lot time if you are planning to develop a website from scratch. Moreover, a website built in Laravel is secure and prevents several web attacks.

 

What You Should Already Know

Before you continue you should have a basic understanding of the following:

  • HTML
  • CSS
  • PHP

 

History

Laravel was created by Taylor Otwell in the year 2011.

The latest version of Laravel is 5.5.0.

 

Advantages of Laravel

Laravel offers you the following advantages, when you are designing a web application based on it −

  • The web application becomes more scalable, owing to the Laravel framework.
  • Considerable time is saved in designing the web application, since Laravel reuses the components from other framework in developing web application.
  • It includes namespaces and interfaces, thus helps to organize and manage resources.

 

How to install Laravel

To install Laravel we need composer dependency tools.

 

First you have to install composer(if not installed) https://getcomposer.org/ .To check composre is installed or not open terminal and execute the below command .

composer 

To install Laravel execute following command in terminal.

composer global require laravel/installer.     

The above command install all dependency of laravel.It will take some time. After complete the execution of above command you can create laravel project using following command. laravel new

Ex. laravel new myFstProject       

Alternatively we can use composer to install laravel project using following command composer create-project –prefer-dist laravel/laravel ex. composer create-project –prefer-dist laravel/laravel myFstProject you can run you project using following command php artisan serve

 

Note:

php artisan     

This command shows the list of all laravel relatated command laravel uses blade templating engine for view Blade is laravel templating engine

 

Directory Structure of Laravel

The image is showing the files and directories of laravel. It is automatically created when we create project using composer or laravel installer.

Let’s we overview these files and directories

first we understand about files

 

.env :

This is environment file where we put credential(username password and other information) which will use in project. Ex. Database username, password, database name , any third party creds like Mailgun,redis etc.

We can change the path of this file for more security purpose. go to vendorvlucasphpdotenvsrcLoader and change it in constructor.

Note: we must never commit this file in bitbucket or github. You may check is already mentioned in gitignore file.

 

.gitattribute

It just hint about git. Don’t think more about this file.

.gitignore

Here we put file name which will not commit in bitbucket or git repos.

artisan

when we run php artisan command in terminal actually we trigger this file only. It run The Artisan Application.

composer.json

This is the configuration file that specifies all dependencies or dependencies for development purpose

composer.lock

It lock the version of dependencies.So, In future when we’ll install dependency, Intall same version.

package.json

This is relatated to frontend dependency. you may find the which frontend dev dependencies (with version) is installed. Ex.vue,jquery etc.

server.php

This file allows us to emulate Apache’s “mod_rewrite” functionality from the built-in PHP web server.

webpack.mix.js

It compiles scss or less or js files.

 

vendor Directory

This directory contain the core files of composer so no need to worry about this and here we don’t create files/folders write code in existing files.

test Directory

This directory contain the test code of our project for testing purpose.

 

storage Directory

It stores logs, files based session and other thing. we don’t more worry about this folder.

route Directory

api.php

Here we can register API routes for our application.

channels.php

Here we may register all of the event broadcasting channels that our application supports.

console.php

Here we may define all of our Closure based console commands and run on terminal. ex. php artisan inspire or php artisan foobar etc.

web.php

we can register web routes for our application. ex. Route::get(‘/’,’RegisterController@index’); Route::post(‘/register’,’RegisterController@register’);

Visit My All Post : www.vkprogramming.com

People also ask

What is laravel and why it is used?

Is laravel frontend or backend?

What is laravel good for?

Scroll to Top