Getting to Know Laravel, a powerful PHP framework

Getting to Know Laravel, a powerful PHP framework

Laravel‘ Introduction

Laravel is the most powerful PHP framework. It is a free, open source framework created by Taylor Otwell and mostly used for the development of web applications. Laravel is based on symfony  PHP framework and follows MVC( Model-View Controller) architecture. Features of Laravel comes with modular packaging system and has a dedicated dependency manager.The source code of Laravel is hosted on GitHub and licensed under MIT License. Latest stable version of the frame work is version 5.7 (while preparing this getting to know session).

Laravel’s First beta release was made available on 9th of June 2011. The latest version 5.7 was released on 4th Sept, 2018. In this seven years Laravel framework has accomplished the milestone of the Best Web App framework. Moreover, because of it being open source, patches are applied very fast and is the securest web framework ever. It can power the Resful Api’s with ease. It is a full stack Web App Framework as It supports many modular packages for frontend, backend and Restful stacks.


Popularity Chart

Now, let us Dive through the Main Features of Laravel and get to know what makes it popular.

Blade Template Engine

Templates are often important part of any framework which lays out the wire-framing of the project to be built. Blade template engine is the simple, yet powerful templating engine provided with Laravel. All views in the laravel are built in blade template which uses the file extension `.blade.php`. The Blade templates are stored in the directory resources/views.  When routed to the .blade.php file it complies the css and js files and then outputs html and javascripts.

Artisan Console

Laravel has in built command line tool called artisan . Artisan’ meaning ‘a skilled person or a crafts man skilled in making handicrafts’. As Laravel’s tag line ‘The PHP Framework For Web Artisans’ says it all.  The artisan is a terminal based command which performs tedious and repetitive programming task. Artisan provides a number of helpful commands that can assist you while you build your application. Artisan can be used to create the database structure, a skeleton code and can migrate database. Which makes it easier to work with database system in laravel. Artisan is used to manage the app you are building like the apps authentications, commands to locally serve the app etc. Artisan also benefits users by letting them create their own command for the lengthy repetitive processes.

MVC (Model- View – Controller) Architecture 

Laravel Follows MVC software architectural pattern and is greatly engraved into the Laravel Framework. MVC basically separates an application into three main logical components : the model, the view and the controller. Each components handle a specific aspect of an application. MVC architecture separates logic from presentation which inturn help to gain clarity in code.

The Modal manages the behaviors and data of the application. It can respond to requests for information, respond to instructions to change the state of its information, and even notify observers in event-driven systems when information changes.

The View  provides User Interface to the application by rendering data from model to the form that is suitable for the user.

The Controller receives user input and makes calls to model objects and the view to perform appropriate actions.

Eloquent ORM (object-relational mapping)

Object-relational Mapping (ORM) is a programming technique that help in converting data between incompatible type systems into object-oriented programming languages. ORMs manages the conversion of simple integer-based relationships in the database to instances of classes. Eloquent ORM provides a beautiful, simple ActiveRecord implementation which makes it easier to work with the database. Eloquent also increase database security. In laravel each database table has a separate model which is used to interact with that table.

Security

The most important aspect of web applications now a days is security. Laravel is the most recommended framework for application security.  Laravel protects cookies on laravel application by generating a application key. The Application Key or Encryption Key uses encryption and cookie classes to generate secure encrypted strings and hashes. Laravel protects the applications from SQL injection by making prepared statements and using Eloquent which are going to escape any user input that may come in through the forms the invalid query will just be saved as text into the database.. Laravel has implemented secure API’s using Auth0 which bring a lot of features like user management, token management etc.

Database Migration

Migration acts like a version control of the database which allows user to easily modify the database structures or schema’s. It removes the hassle of recreating the database or modify database every time developer makes changes to it. User can easily migrate tables, seed it and use php code to control and modify the database without using any SQL codes. Moreover, user can create indexes using the schema builder.

Libraries and Modular Packages 

Laravel consists of large collection of library files some of which are pre installed and other can be easily installed using composer (If you don’t know what composer is yet, please stay tuned for our next blog where we’ll guide you to install Laravel using composer). One of the preinstalled libraries is an Authentication library which is easy-to-implement and has many latest features, such as checking active users, Bcrypt hashing, password reset, CSRF (Cross-site Request Forgery) protection, and encryption.

Applications can also be packaged in to modular packages which is used to add functionality to laravel applicaiton. Packages might be anything from a great way to work with dates like Carbon, or an entire BDD testing framework like Behat.

The above mentioned are the important features built in to laravel which makes it popular among other frameworks. Catch our next blog related to laravel where you can get along with laravel by learning how to install laravel and create your own blog project. So, Stay tuned.