In our earlier article, we clashed two web development platforms, PHP and Python, in an attempt to find out who is the ultimate winner. As it turned out, both of them can become your go-to platform depending on a range of external factors. For example, your experience and presence of shared environments. The competitors keep up with each other in most of the comparison criteria like community support, debugging, and frameworks. 

Today, we’ll dig deeper into the framework topic and get to know what to look for in popular PHP frameworks.

What is a PHP framework?

A PHP framework is a platform for creating web apps. It helps to streamline the development process providing the basic structure for app building.

A PHP framework contains a set of libraries, classes, and elements of design pattern realization on which software engineers code.

Why use a PHP framework?

Employing a framework allows developers to focus on creating the actual website application instead of spending infinite time on writing repetitive code. Other advantages include:

  • Increased speed of development due to the reuse of code across projects.
  • More stable applications. A framework ensures proper database interaction with code on the presentation layer. 
  • Security. The frameworks are open-source, so any security issue is quickly spotted and fixed by community members.
  • Easy maintenance. Coding with PHP frameworks doesn’t differ from doing it in Core PHP. So any PHP developer can fix or debug something in your application. 

However, you should keep in mind the disadvantages of using a PHP web framework.

  • Slower execution. PHP libraries and classes add complexity and overhead. If you are running a quick script and API with limited functionality, a simple PHP script might be a better choice.
  • Learning. It will take time to understand the design patterns behind PHP frameworks if you want to keep your app structured. So if your project is small, it will be reasonable to use the libraries you are familiar with.
  • Too general for specific problems. A framework encompasses a range of solutions for recurring requirements of developers. You will solve your specific problem but at the same time get functionalities you don’t need and will have to remove them. 

That is why it’s important to choose the PHP framework that fits your app’s needs. 

Overview of the Best PHP Frameworks in 2020

We are going to compare the most used PHP frameworks:

  • Laravel
  • Symfony
  • Zend 
  • YII/YII2
  • CakePHP
  • CodeIgniter

…and share some facts about four more frameworks that worth to be considered:

  • Phalcon
  • Swoft
  • Lumen
  • Slim

Let’s first view how the technologies have trended over time in Stack Overflow and Google. According to Stack Overflow, Laravel is way ahead of its peers with around 1.6% of questions by 2020. Symfony and CodeIgniter follow the leader, with around 0.2% of questions.

PHP framework performance according to Stack Overflow
PHP framework performance according to Stack Overflow

If we compare the top three PHP frameworks in Google Trends for the past 12 months, we’ll see that Laravel outperforms the rest of the gang as well. By the way, you may get more useful information about it, diving into our Laravel Tutorial.

The numbers in the picture represent search interest relative to the highest point on the chart for the given time worldwide. A value of 100 is the peak popularity for the term. Laravel has scored 93, Symfony – 18, and Codeigniter – 14.

Top 3 frameworks in Google Trends
Top 3 frameworks in Google Trends

That’s how other frameworks perform: YII2 has scored 73, CakePHP – 57, Zend – 37, and YII – 36. 

Other PHP frameworks in Google Trends

The tables below represent more parameters to compare the most popular PHP frameworks, such as release date, popularity, PHP version required, and speed.

Basic information

Frameworks Laravel Symfony Zend YII/YII2 CakePHP CodeIgniter
Release date 2011 2010 2006 2010/2013 2005 2006
Website Website Website Website Website Website Website
Tutorials Tutorial Tutorial Tutorial Tutorial Tutorial Tutorial
GitHub URL GitHub GitHub GitHub GitHub GitHub GitHub
Current version 5.8 4.2 3

2.0.5

3.7 3.1.10
PHP version required 5.6.4 5.6.0 5.6 5.4 5.6 5.3.7
License MiT license  MiT license New BSD License New BSD License  MiT license  MiT license

Popularity

We don’t recommend to go by this criterion alone. However, popular frameworks have a wider community, hence more information and help for developers

Frameworks Laravel Symphony Zend YII/YII2 CakePHP CodeIgniter
GitHub stars 56.8K 22.4K 5.7K 4.9K/ 13K 8.1K 17.8K
Twitter followers 108.2K 36K 47.4K 14K 17.7K 23.2K
Downloads (from Packagist) 79M+ 46.2M+ 5M+ 2.1M+ 4.9M+ 610K+

Features

The following table covers the essential features to look at while choosing a PHP framework for your project. 

Speed determines how swift your web application will be. Object-relational mapping (ORM) are the components that help you to transform your database access in a more object-oriented manner. Code generation creates files and default content automatically. Edge Side Includes (ESI) allows to cache the whole page and update only those parts that have changed. Extensive cache storage will cover the most advanced cash needs. Multiple databases will fit more data and provide better security for it.

Framework Laravel Symfony Zend YII/YII2 CakePHP CodeIgniter
Speed (Rest API) 5.5 ms 2.2 ms 3.9 ms 3.2 ms (slowest) 5.8 ms no information
ORM ELOQUENT ORM (active record) Doctrine 2,
Propel (active record)
Doctrine, ZF Database
Access Objects (DAO),
Active Record (AR)
Custom ActiveRecord
Code generation CLI CLI no information YII CLI, GII (Web based) CLI no information
ESI no information Yes,
include tag only
no information no information no information no information
Cache storage File System, Database, Memcached, APC,
Redis, Xcache, WinCache, Memory (Arrays)

HTTP,
APC,
eAccelerator,
XCache

no information

APC, Database,
eAccelerator,
File,
Memcache,
WinCache,
XCache,
ZendPlatform

Memcache, APC File, APC, Memcache, Redis File,
APC, Memcached, XCache
Multiple databases Yes Yes No Yes Yes Yes

Demand

We’ll round up our PHP framework comparison with the final table demonstrating the general situation on the job market. We’ve consulted two biggest job-listing search engines: Indeed and Monster. As you can see, both search engines give the same top three: Laravel, Symfony, and Zend.

Indeed

Framework Laravel Symfony Zend YII/YII2 CakePHP CodeIgniter
Number of jobs 829 398 175 35 22 60

Monster

Framework Laravel Symfony Zend YII/YII2 CakePHP CodeIgniter
Number of jobs 93 47 24 7 9 11

Additional Frameworks: Less Popular but Still Worth It

Phalcon

Phalcon is a new open-source framework that is becoming more and more popular among developers. Nowadays it considers one of the fastest frameworks. You may compare it with other popular frameworks on the official Phalcon blog.

This PHP framework was developed by Andres Gutierrez and his collaborators and released in 2012. It was originally written in C and C++. The current version is 4.0.3.

Phalcon actually combines PHP and C language. Its tutorial provides an overall view of the Phalcon framework and how to use it.

It’s better to initially have knowledge of HTML, CSS, and PHP as well as the basic understanding of the MVC framework before starting to learn the Phalcon tutorial. The experience of working with traditional frameworks like Laravel or Codeigniter would be an additional benefit.

What are the reasons to use Phalcon?

  • It is easy to install and appropriate for creating flexibly configurable apps.
  • Its functionality includes asset management, increased execution speed, universal autoloader, strong security and caching.
  • It optimizes performance thanks to effective memory utilization that makes Phalcon proper for creating blazing fast websites.

Swoft

Swoft is a PHP high-performance framework that has many chances to become the best choice for PHP. This microservices coroutine framework looks appropriate for building web systems, APIs, middleware, and basic services.

Swoft is based on Swoole native Coroutine. It can be a Go, built-in coroutine web server and common coroutine client and is resident in memory, independent of traditional PHP-FPM. 

What are the reasons to choose Swoft?

  • It comes with a resident memory and a set of other Swoole features.
  • You get Mysql/Redis/RPC connection pool.
  • You may use AOP for all objects managed by the framework container. It will allow you to control the behavior of instance objects without changing the inside of the instance.
  • The RPC service is divided into RPC Server and RPC Client. Swoft provides an advanced way to use RPC services.
  • It provides a range of rapid build microservice governance components for small and medium-sized businesses (for example, service bucks, service registration and discovery, service throttling).

Lumen

Lumen is a new project created by the Laravel creator, Taylor Otwell. This is a kind of micro-framework that is a smaller and faster version of a full web app framework. It is primarily built to deliver microservices and blazing fast APIs.You may learn more about in in the official tutorial

What is it for?

You may need Lumen for projects and components that can benefit from the power of Laravel but can afford to sacrifice some flexibility and configurability in exchange for the advanced speed. Lumen is targeted at microservices – separated components with bounded contexts. That is why in a microservice architecture you might have several small Lumen apps.

Learn more about the difference between Laravel vs Lumen here

Slim

Slim is another micro framework that will assist if you need to create an API. Actually, Slim is often compared with Lumen. It also helps developers quickly create simple but powerful web applications and APIs.

Key advantages of using Slim

Slim is rather simple to learn. PHP developers use Slim to develop RESTful APIs and web services. Among the core features, they highlight URL routing, session, and cookie encryption, client-side HTTP caching, and many more.

It is a good option for a small web app that doesn’t necessarily require a full-stack PHP framework. Besides, its handy documentation and professional maintenance make Slim friendly and high-demanded.

Some More Interesting Facts…

We’ve also compared all these PHP frameworks considering parameters from Ahrefs.com:

  • We’ve checked Domain Rating that demonstrates the relative “backlink popularity” of the target website compared to all other websites. It is based on the number of websites linking to the domain’s URLs and their backlink profile strength.
  • We’ve also checked Ref Domains that shows how many unique referring domains link to a target in total.
Domain laravel.com symfony.com yiiframework.com cakephp.com codeiginter.com
Domain rating 90 88 87 85 82
Ref domains 36,182 24,355 12,934 12,435 12,042
Domain framework.zend.com phalcon.io swoft.io lumen.laravel.com slimframework.com
Domain rating 90 74 2 90 80
Ref domains 17,403 2,200 6 1,257 9,012

Click on screenshots to enlarge images:

1 table 1

 

table 2

On a final note

PHP frameworks are a great way for a novice developer to gain vast experience in creating web apps. Their code is well-tested, you get to know all the best practices and get support from the community. 

Even if you are an expert PHP developer and don’t usually use frameworks, they can still be a helping hand in projects with tight deadlines. Which framework to choose depends on the specific requirements of the project.