Home / My Thoughts / 5 Reasons You Should Try The Laravel PHP Framework

5 Reasons You Should Try The Laravel PHP Framework

I have been a php developer for 2 years now and in that time I never used a Framework. I was obsessed with learning many programming languages, but after almost a year, I decided to concentrate on being a web app developer, using primarily PHP. PHP is awesome and it is one language I understand extremely well and can express myself, just like JAVA, but I still prefer PHP. A friend of mine introduced me to the PHP Codeigniter framework, and I decided to try it.   I started learning and the documentation was absolutely fantastic. It took me a couple of days to grasp it, but honestly, I wasn’t attracted to it. I didn’t really like the idea of using a framework and I went back to writing raw PHP code. I enjoyed it, but I knew I had to change my ways, if I wanted to write really huge enterprise applications. I graduated from University last month and I got my first official job at a start-up (even though I have worked on a bunch of project) and they use the Laravel framework.There was no turning back, I had to learn how to use the framework.   I dedicated a coupleof days to learning how to use it and 6 weeks in, I am totally enjoying using the framework, and I think everyone should try it out. Codeigniter is good, but Laravel is indeed a framework for Web Artisans. :). Don’t get me wrong, it has it’s flaws, but I try to find my way around it and we are currently building a very powerful application that runs on the Framework. Laravel is a web application framework with expressive, elegant syntax, and here are reasons why I think you should try it :

1. Migrations

Migrations are a type of version control for your database. They allow a team to modify the database schema and stay up to date on the current schema state. I personally love migrations. I do not have to worry about reminding my team member to send me an SQL export of a table, and wondering why I am getting so many errors after pulling from Github. With migrations, you simply write out your query, using the Schema Builder to easily manage your application’s scheme. After creating a database/table, simply push to git and when you team members pull, the only thing they have to do is run the command :

and all databases and tables are created. No need for exchanging sql. You can also rollback your migration, aka. drop your previously created table or database with a simple command : php artisan migrate:rollback or reset all migrations php artisan migrate:reset

2. Eloquent ORM

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database. Each database table has a corresponding “Model” which is used to interact with that table. Eloquent helps you write more readable code in php, yes you heard it right, ‘ IN PHP ‘ ! I know most of us nearly gave up on the language because it took so much code to do a simple thing. Eloquent is amazing and there is just so much you can do with it. It all starts with creating a model and extending Eloquent

Let’s say you want to get all rows from the table user;

Isn’t that better and cleaner? How about this, calling relations simpler :

Laravel also has a query builder which uses PDO parameter binding throughout to protect your application against SQL injection attacks.

3. Authentication

Usually with raw PHP, we use either Sessions or Cookies to authenticate users. We have to write out our own algorithm to handle how we want to authenticate users. Laravel, takes that load off, by providing it’s own sleek and intuitive Authentication library. It was quiet frustrating at first because I didn’t fully get the concept but I was blown away by how easy it makes every form of authentication when I took my time with it. No more :

Laravel makes it easier and you can authenticate anywhere in your code. Let’s say you want to grab the status of the current (just one) user with $id and whose department id is Authentic as the Authenticated user’s id. You authenticate and fetch at the same time!

Isn’t this awesome security?

4. Blade Templating Engine

No more spaghetti code and php tags everywhere. With a lot of different templating engines that integrate well with PHP such as Smarty and Twiggy, I think blade stands out. It is very concise, easy to learn and implement. yet powerful and gives great results. Blade comes with Laravel and integrates really well. No more ;

Instead, blade summarizes all that. With blade simple save lines of code by writing;

Blade replaces the traditional PHP ‘echo’ or ‘

@extends(‘layouts.master’) @section('sidebar') @parent

@stop @section('content')

5. Documentation

There are a lot more reasons you should try Laravel but I want to keep my points at 5, and one of the main challenges developers face when trying something new is the lack of available resources to help in the learning curve. The Laravel team however knows that and put together a clean and awesome documentation. The documentation is precise with straight up examples and usage. It isn’t the best documentation though, and CodeIgniter beats it any day, but it’s a good start and it gets you started with the framework comfortably. Overall, I think Laravel is a great framework and with time more people will appreciate it. Below are links to some Laravel resources and let me know if you would like a tutorial.

Some useful Laravel Resources:




Documentation : http://laravel.com/docs

Laravel Book, Code Happy . (A great book by the way) : by Dayle Reese

Andrew Perkins’s Youtube Laravel Tutorials

Michael Calkins’s Youtube Laravel Tutorials

Cheers!

 

 

 

 




31,715 total views, 3 views today

Check Also

Android Development: Styling Google Maps

Google has a reputation for making development easier and efficient for developers who use their tools ...

Leave a Reply

Your email address will not be published. Required fields are marked *