Goodbye to CodeIgniter: Hello to Laravel?

When it comes down to PHP frameworks, in my opinion there are only two worth mentioning; CodeIgniter and Laravel. I have been a fan of CodeIgniter for a while now, and developed a sort of long lasting working relationship with it. However, lately I feel that I am naturally progressing towards Laravel. Both have their advantages and disadvantages but is it time to bid farewell to CodeIgniter and hello to Laravel?

 

CodeIgniter: a love story

As a developer I like things to be clean and simple, I like things to follow a perfect pattern and for every little cog in the machine to conform to some sort of standard; that’s why I love the MVC pattern and in turn frameworks. I have been using CodeIgniter for the past 4 years, I have created many libraries, helpers and extensions which now all form part of Kalexiko’s custom CMS. It is for this reason I would find it very difficult to jump ship and pick up Laravel without good reason. CodeIgniter has served me well in all the time I have used it, however it is far from perfect.

CodeIgniter was built with backwards compatibility in mind, which means you can run a CodeIgniter application on pretty much any server out there. This is great for distributed applications. However this versatility comes at a price. CodeIgniter was designed for PHP4 at a time when PHP 5.2 was at its most popular; eventually it caught up and now requires PHP 5.2, however that is now two major revisions behind by providing legacy support CodeIgniter has been unable to utilise the latest features and, of-course, best practices introduced in the latest revisions of PHP.

That aside my biggest annoyance in CodeIgniter is the ‘CI Super Object’, yes super object makes it sound mystical and amazing, but truth be told it’s an ugly hack, an ugly hack that obscurities and confuses matters, on top of that it will break your IDE?s code completion.

function controller_method() { $this->load->library('kalexiko_magic'); $this->kalexiko_magic->alakazam(); }

 

So is the end for CodeIgniter?

One thing CodeIgniter is well known for is its active community; hundreds of developers chat daily in CodeIgniter’s IRC channel, dozens of libraries, helpers or snippets are shared on the forums daily and if you are ever in trouble with CodeIgniter and need a helping hand the forum is very active and I have always felt that queries are always answered quickly.

 

CodeIgniter is a rock. It’s solid, it’s stable; with so many users and applications based on CodeIgniter out there it’s safe to say that the code base is well tested and well documented, if you have a problem with CodeIgniter you can bet that 20 people before you have had the same problem and solved it! In all honesty, CodeIgniter is easy to grasp, very easy! Anyone who has a basic understanding of PHP will find CodeIgniter very welcoming and easy to grasp. Due to this, I think it will always be the framework of choice for novices, this is in no small part down to CodeIgniter’s fantastic documentation. Now that secret is out my reputation as a coding genius is shot!

 

So because of all this I believe that CodeIgniter will never truly die, it will live on in one form or another for a very, very long time. But all of this isn’t enough for me anymore, I want more…

 

Laravel: the new kid on the Block

In our community, everybody loves a bandwagon and at first I thought all this talk of Laravel was just that, another bandwagon that would pass in a few months time? That was a year ago; how wrong I was. Laravel is a relatively young framework, it’s only around two years old, however it’s already well on its way to its 4th revision. That is a true testament to how fast-paced Laravel’s development is.

 

When I used Laravel I immediately felt right at home, the familiarity of the file structure allowed me to jump right in at the business end; that’s the beauty of MVC. Maybe it’s the documentation, which is as clear and concise as CodeIgniter’s. When writing code for Laravel you feel awesome. As ridiculous as that sounds it’s true, Laravel has this affect on you that makes you believe your code is godly, I can’t put my finger on why this is, but it is.

 

One of my other minor grievances with CodeIgniter is that a lot of functionality that I would consider ‘core’ would require me to write this functionality myself or rely on a third party library or extensions. Laravel has this covered, out of the box Laravel has:

  • User Authentication
  • Stack Trace
  • Asset management (JS, CSS)
  • Templating

We have all of this in Kalexiko CMS right now but all were custom built and are not part of CodeIgniter’s core libraries, with Laravel development time can be focused on the fun stuff as opposed to having to re-engineer this functionality just to get started.

 

Something I noticed immediately was how expressive Laravel is. It almost feels as though I’m ‘talking’ to Laravel to get it to do what I want to happen as opposed to writing procedural code to achieve it. Everything makes sense in Laravel, and when you read back code that other developers have written it explains itself without the use of comments or documentation, it truly is a breath of fresh air!

 

public function showProfile($id) { $user = User::find($id); return View::make('user.profile', array('user' => $user)); }

 

Up until this point I have only played around with Laravel, and unfortunately haven’t had the opportunity to really get my teeth into it, but I will and rest assured I’ll share my findings here on the Kalexiko Blog!

 

So in conclusion CodeIgniter is reliable and by no means dead, here at Kalexiko we will continue to use CodeIgniter for the foreseeable future, that being said I have plans to base rebuild Kalexiko CMS version 5 using Laravel to take full advantage of the power of PHP5 and Laravel which will enable us to continue to deliver elegant, cutting edge solutions to our clients.

SHARE: