PHP MVC Frameworks Comparison 2015

I’m in the IT industry for over 10 years now and doing PHP programming for a long time. I’ve started my career with PHP 4 and obviously reached up to a point of doing Spaghetti Code. I bet, 80% of the PHP developers gone through this phase. However, when we learned using structured coding with a fragile OOP concept it becomes harder to write the codes but easier to manage it.

There were PHP frameworks as well. With the release of PHP 5.x, many good PHP frameworks emerged and many got upgraded. PHP frameworks are great for rapid development as they include lots of prewritten class methods and helper functions that significantly reduces the amount of code you have to write your own. So obviously this saves the development time altogether.

But as said earlier, there are many PHP frameworks available online among which, 90% are open source. Before you choose for a framework, you need to check at least three aspects, one – performance (the most important part), two – purpose (do not use over featured frameworks that your project does not need), and three – ease of use and inbuilt utilities. And the common is obviously you have to learn that framework syntaxes.

I’ve used CakePHP, Codeigniter, and Laravel myself. So I thought to put together a comparison (obviously did some research from the online sources) of the frameworks for the sake of making a decision faster. Here is a survey result available from Sitepoint as well. Another good framework introduction available online (a bit old though) by Mashable.

Laravel Framework:
Laravel PHP framework is known as a framework for web artisans. It’s a very good web application framework with elegant syntax patterns, lots of inbuilt common functionalities like authentication, file uploads, etc. It also offers strong routing and caching features. It is integrated with unit testing support. It can be used for very large applications or simple JSON-based APIs. Laravel supports MySQL, PostgreSQL, SQL Server, SQLite. The most important point to know is, Laravel is built on Symfony core which itself is a very popular framework. Laravel comes with Composer and vendor packages installation is a charm.

Pros:
1. The beauty of the static class concept
2. Modularity and extendability via “bundled” packages
3. Lots of pre-build vendor packages available
4. Supports both Query Builder and ORM (Eloquent), and both are very strong
5. No unnecessary support for PHP < 5.3
6. Super strong routing including reverse routing
7. Artisan for ease of CLI use
8. Blade templating engine, which is a good one

Cons:
1. A bit less detailed documentation on their website, than what’s Laravel capable of.
2. A comparatively newer framework, so less discussion/forum threads, and fewer sample codes are available on the web.

Symfony Framework:
Actually, Symfony is the base of Laravel! This PHP framework is quite good. Symfony is a set of reusable PHP components. And Symfony framework is built on top of those components. “Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community – all working together in harmony.” – as described in the Symfony PHP framework website.

Pros:
1. Reusable and decoupled components that can work together or independently.
2. Highly performing, faster, and less greedy.
3. The ultimate flexibility in terms of dependency control.
4. Quickly and easily expandable.
5. High-level ease of use.

Cons:
1. Very steep learning curve.
2. Documentation could be better.
3. A bit of a lack of community support.

Codeigniter Framework:
Codeigniter is a lightweight open-source PHP framework. It is small and elegant yet powerful enough to create full-featured web applications. It is also a heaven for beginners. Codeigniter is neither over complicated nor includes complex large-scale libraries. It can be started with minimalistic configuration and most important, it has clear documentation. Yet, in the period of PHP 5.6, it surely lacks some flavors and standards.

Pros:
1. Super easy to set up and use
2. A very well documentation in their website
3. Lots of users, so lots of web resources, help, forum threads available
4. The comparatively easier learning curve
5. Loosely-coupled, so the convention can be broken in any complex situation
6. Suitable for entry-level developers in PHP MVC Framework world

Cons:
1. The same pros can be treated as the cons like loosely-coupled help to break the convention, which further leads to the security flaw
2. Misses the flavor of “namespaces”

Zend Framework:
Highly efficient, most secure, and enterprise-ready PHP framework ever built! Zend PHP framework has a proven track history of continuous enhancement and up-gradation to aid critical and high-usage applications. Lots of third-party modules available due to its highly modular structure.

Pros:
1. The monster framework has almost everything you can think of.
2. Great community support.

Cons:
1. A monster framework, the pro is the con here in a case to case basis.
2. Huge learning curve. Not suitable for beginners at all!

CakePHP Framework:
CakePHP is one of the oldest PHP frameworks. It was introduced back in April 2005 and in May 2006 the first version of it, Version 1.0 was released. Nowadays a PHP developer has a lot more choices for the MVC framework, but during that time, CakePHP was the top one. It’s still ranked among the top 5 most popular PHP frameworks. Recently they have launched Version 3.x with much better performance, enhanced components and helpers, improved session management, stronger ORM, and better conventions. I learned CakePHP first, before Codeigniter and Laravel. So at first I was convinced that CakePHP is the best framework in the PHP MVC world. But I could realize the hard part of it once I’ve become familiar with Codeigniter and then Laravel.

Pros:
1. The strict convention helps to keep the coding style more or less the same among team development.
2. Built-in ACL (Access Control List) and Authentication feature.
3. Supports templating and scaffolding.
4. Multi-language support.
5. Full ORM support.

Cons:
1. Very orthodox type, the strictness of the conventions sometimes becomes problematic, like table and controller naming, etc.
2. Documentation still can be better in the CakePHP site.
3. Need to update default routes for fancy URL generation.
4. It seems to be one of the slow frameworks. The latest version of it is much faster than the previous one, but still comparatively slower than CI or Laravel.
5. Auto-populating of related model records creates a performance issue in large application type projects. The developer needs to specify not to pull the related model records recursively while doing the query.
6. Blamed as a legacy framework for its consistent support of PHP 4, but now this is not a valid point with the release of CakePHP 3.
7. Using data arrays rather than objects, but this point also voided with the launch of Version 3.

YII Framework:
It is fast, secure, and professional. Somehow YII PHP framework is able to get its own place in the market, but I’m still unaware why in the world, a PHP developer should use this framework where lots of already established frameworks exist? Maybe I’m a little bit biased, but it doesn’t offer any extra functionality or feature than a regular PHP framework.

Pros:
1. Active record support.
2. Multi-language support.
3. In-built authentication.
4. Scaffolding.
5. Role-based access control.

Cons:
1. Not much popular, so very less community support.
2. Not offering any special feature of functionality to choose over other frameworks.

Phalcon Framework:
Phalcon is one of the most debatable frameworks built for PHP. It’s not a PHP framework actually. It’s basically developed in C language. You can think of Phalcon as a PHP component. Like if you install any PHP library, then you can use that feature/functions in PHP, Phalcon is a kind of component, installing which you can use the framework classes of it. PSR autoloading can sometimes be slow, but how about having the whole framework available as a preloaded PHP component in the server itself! This is the reason Phalcon is super fast.

Pros:
1. Lightning-fast.
2. All the Classes are autoloaded in server memory and the methods are readily available.
3. No option of hacking the core framework files as those are not PHP files at all.

Cons:
1. You must need a dedicated server where you are allowed to install components. You can’t use a shared server.
2. Need to know SSH commands to install the component
3. Dependency on the server in case of server switching

Conclusion (obviously in my own opinion)!!!!!

If you are completely beginner to an MVC PHP framework, start with Codeigniter. If you are thinking Enterprise, opt for the Zend PHP framework. And if you love beautiful coding 🙂 use Laravel.

Leave a Reply

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