PHP Framework Comparison: CodeIgniter vs Laravel vs Yii vs CakePHP
Frameworks give us a set of tools to build our web application on top of. These technical tools are packaged together to make a framework for open-source rapid web development in PHP language. PHP is indeed blessed with some great open-source web development Frameworks.
And we are not able to talk about Zend, Phalcon, Fat-free or FuelPHP. All great frameworks in their own right. However, we simply do not have the background knowledge to discuss. All these frameworks are built on MVC (model-view-controller) architecture. The tools such as following are available out-of-the-box with most web Frameworks.
- Structure your application in some pleasant standard patterns
- Built-in classes such as session handling, database, security, user input validation
- Helper functions/classes such as to interact with a 3rd party API integration
- Test code quality
- Ability to deploy code quickly
Here we’ll discuss and compare the famous PHP frameworks for their ability against each other. For ease of use, we’ll discuss these frameworks one by one. We’ll later on add more frameworks as we go along to make the PHP framework comparison. We are only adding frameworks which we work with and support for our clients. We will give points to each framework for their performance in a certain aspect. We’ll add more points of discussion in further iterations.
The qualities we’ll be mainly comparing will be
- Trend and popularity
- Structure and Updates
- Libraries and online help
- Database integration
- Ease of development and templating
- Developer cost
So here we start with PHP framework comparison one by one.
CodeIgniter was the original PHP framework. First developed in 2006, it’s been here forever. Its development got slower citing lack of resources for active development. It got stuck in 2.x for a long time; it finally entered 3.x in 2015. After a long time, it reached version 4.x in 2020, its most recent major version. CI 4.x required minimum version PHP as 7.2 to run. 4.x finally is a modern PHP framework and uses latest features like Namespaces, DB Migrations, API support and CLI – the features that Laravel developers are using for years and years. CodeIgniter is mostly popular in South Asian web developers such as India, Pakistan and Bangladesh. Codeigniter is considered to be very light weight, simple and elegant framework written in PHP.
- Trends and popularity: CodeIgniter has always been popular. It provided ease of use in 2.x and hence most web developers preferred CodeIgniter. There were a lot of websites built in CodeIgniter and it will stay relevant. However, all the new developers are now going towards modern frameworks such as Laravel or ExpressJS. With most CI apps stuck in 2.x, the popularity has certainly taken a slightly downward turn. 2.5/5
- Structure and Updates: The structure is MVC (model-view-controller) and provides easy on-boarding. The structure was loosely based on Object-oriented programming but most developers used it according to their needs. The framework used to be case-insensitive. Codeigniter 4 has its structure organized in 5 directories: app, system, public, writable, tests. There is now CLI, Composer support and ability to develop API but still no Middleware support. 3/5
- Libraries and online help: The CodeIgniter provides a lot of built-in functionality and their website has a handy guide for use. With . They have now introduced strong caching support in 4.x. With Composer, you can now load all kinds of third party libraries to help your project. 4/5
- Database integration: CodeIgniter provides relational databases such MySQL or PostgreSQL by default. With 4.x, CodeIgniter now comes with composer by default so you can use third party libraries for databases such as Mongo. CodeIgniter database support is still rather limited. You will not find the same database tools that are available in, say, Laravel. However, CodeIgniter does comes with its own ORM tool. 3.5/5
- Ease of development and templating: CodeIgniter is easy to use and has the least worrisome learning curve. Along with there being no template engine, there is pure PHP code going around everywhere. 4/5
- Developer cost: There are a lot of legacy apps that still need maintaining. CodeIgniter has the most readily available PHP developers. It is very easy to hire CodeIgniter developers and they usually work around $10-12 rate but good ones go around $12-15 maximum. 4/5
The Right Software have developed a number of accomplished PHP projects in CodeIgniter and have hired expert CodeIgniter developers. We are also able to help update legacy, out-of-date CodeIgniter websites to make them up to date with latest framework version or to convert them into other modern frameworks.
Related: 7 Steps to CodeIgniter performance optimization
Laravel framework is the most popular right now. The first version came out in 2011 so it is relatively a new framework considering that most of PHP frameworks started out in 2011. However, that hasn’t stopped Laravel framework from taking over the PHP web development scene. Laravel is currently on 6 version however there are some websites still in Laravel 4 as the jump is a bit steep and manual porting of the code is required. Laravel is most popular in web developers from the 1st world countries such as US, Canada and Europe. However, its making inroads with higher adaption rates among web development companies from other regions as India, Pakistan and China also.
- Trend and popularity: Laravel is at its peak popularity right now. With its style favoring the expressive coding favored by the seasoned developers, Laravel is going from strength to strength. Laravel jobs are what come up the most in freelance circles as well. 5/5
- Structure and Updates: Laravel follows MVC structure of files. Laravel comes with a command line tool called the Artisan. Laravel Artisan has all the developers drooling over its features. With Artisan, you can create models and controls, setup scheduled tasks, queues and custom commands. The other important tool Eloquent helps us to interact with database, create helpful magic methods and retrieve data. Laravel updates are common and recurring. 5/5
- Libraries and online help: Laravel’s best help is its own official documentation which is very elaborate and helpful. However, you can get great help from Laracast.com. The number of standard Laravel libraries that you can composer into the Laravel project is staggering. You can find in 100s of libraries in Packagist. SIimilarly, you can find great help on Stackoverflow. 5/5
- Database integration: Laravel comes with its own ORM tool. Laravel comes with migrations for easy port of database changes and versioning. Similarly, Laravel comes with a Seeder tool to introduce test data. Laravel also comes prepackaged with Redis key:value store. Rest, Laravel has packages for every database available. 4/5
- Ease of development and templating: Laravel comes with Blade template engine which is good for frontend developer who do not have to learn PHP. Laravel makes development easier by providing features like routing, database migrations, eloquent and query builder, command line utilities, built in paginations etc. Another very useful feature of laravel is template engine. Using Blade, we can inherit templates as well define sections. 4/5
- Developer cost: Laravel development services are a bit costlier than custom PHP or CodeIgniter. However, Laravel developed projects are most true to its roots of pure strong MVC. That way your end product needs least amount of engineering in coming years. Still, the Laravel developer hourly rate is around $12-18 with the best companies charging a bit more for the overall accomplished experience. 4/5
Laravel is the most popular PHP framework and is here to stay. The Right Software team prefer Laravel framework web development and help our clients by building the code in Laravel.
Related: Laravel eCommerce solution for small businesses
Yii is a popular framework for web developers from China and Russian block mainly. Yii came about in 2006 from PRADO framework; it followed CodeIgniter in that it remained stuck in 1.0 and 1.1 for a long time until 2014 when the initial mistakes were fixed and a 2.0 was launched. That was when it touched its peak popularity. It’s been slow and downward curve since then. Yii is still on 2.0.x.
- Trend and popularity: Yii’s has been a slow and ponderous journey. Popularity was there a couple of years ago and there are websites and apps developed in Yii from that era which need updates and maintenance. However, Yii is not the first choice these days. 2/5
- Structure and Updates: Yii follows strict MVC approach and strict naming conventions for files. The updates in Yii are not so frequent compared to other frameworks. It was introduced a long time ago and still in version 2.0.x. 3/5
- Libraries and online help: Yii is an oldish framework and hence has a lot of online tutorials and help available for web developers. It has a very good documentation which provides most of the answers. There are enough packages on Packagist.org to make a strong claim. 4/5
- Database integration: Yii provides decent database support, you can work with different databases which includes SQLite, PostgreSQL, Oracle, MySQL and other relational DBMS. It has built in support ActiveRecord ORM. However, we can find third party packages for MongoDB, Microsoft BI. 4/5
- Ease of development and templating: Development is much more faster in Yii, due to automatic code generation feature, which can be achieved by using its extension named gii. Gii supports both command and gui interface. With gii one can create anything from a simple model to complete CRUD. For more information on gii, please check the documentation. Yii does not utilize any templating system by default, but it has the capability to use third party templating systems like Twig and Smarty ;which might be helpful if someone has a Symfony framework background which uses Twig. 4.5/5
- Developer cost: Yii lies to the advance spectrum of PHP Frameworks and hence the developers may cost a bit more than custom PHP developers or CodeIgniter developers. You should be able to hire Yii framework developer in $14-$18 per hour bracket. 3.5/5
Yii Framework is a good choice if you have clients from China or Russia and they require you to update Yii applications to latest versions.
CakePHP framework was one of the original offenders. It came about in 2005 even before CodeIgniter. CakePHP reached peak popularity in 2009 even before its popular version 2.0 release in 2011. It has been a downward journey ever since. Still it is on a respectable version 3.4 and a middling yet solid choice among PHP Frameworks. There are plenty of CakePHP development projects that need updates and modernization.
CakePHP has been popular in Bangladesh most of all places followed by Japan.
- Trend and popularity: As discussed a bit above, CakePHP usage has been going down slowly since 2009. New jobs in CakePHP are coming less as other frameworks have taken over the mantle. 5/5
- Structure and Updates: CakePHP code follows a very strict methodical approach and was actual modelled on Ruby on Rails. The file and database names are strict. The framework follows conventions in naming and is something to be proud of. Laravel Framework took this approach with Artisan based scaffolding. However, its development continues and it has a very active following and release timeline on Github. 4/5
- Libraries and online help: CakePHP has a long history and finding CakePHP help and tutorials on the internet is very easy as there are plenty of resources. CakePHP comes with Composer and should be fairly easy to add vendor libraries. 4/5
- Database integration: Database access itself is a breeze in CakePHP what with all those naming conventions. Framework comes with ORM and query builder tools. CakePHP comes with support for convention relational databases including Oracle. However, for NoSQL databases you have to get third-party libraries. 4/5
- Ease of development and templating: If you follow CakePHP design pattern then you should be fairly set for a quicker development cycle given its adherence to standard practices. Time should be saved. CakePHP follows a crude PHP structure in templates but allows Twig templates which should be great for UI developers. 4/5
- Developer cost: Against all these good points, CakePHP developers should still be fairly easy to get and in the bracket of CodeIgniter in development cost. You should get great CakePHP services in $12-15 per hour. 4/5
CakePHP is a strong choice in light of above discussion against CodeIgniter or Yii. However, CakePHP resembles Laravel too and for clients an cost-beneficial choice behind Laravel for PHP web development.
These are all wonderful frameworks and any one of them would suit you instead of starting from scratch as they bring their own convenience and in-built value. However, its good that for your PHP web development, you should hire a developer with framework skills that are relevant and modern. Our best PHP Framework is Laravel. Hire Laravel developers for your web application.
- Note: This article will expand as more information is added on-going.
- On suggestions, we’ll add more points and frameworks here. Please add your comments to guide us.