7 PHP Frameworks Tested For Speed

In this article, we will look at seven great, lightweight PHP frameworks. Each framework has been tested for speed and useability. We will be looking at the following frameworks: Cakephp, CodeIgnitor, Symfony, yii, RainFramework, Doophp, and Kohana.

PHP frameworks allow you to quickly develop web applications and websites. In an application setting, there are two types of people that will be working on the project. The first is the web designer, whose primary concern and interest is the look and feel of the website (the “presentation”). The second is the PHP developer/programmer that writes the PHP code to do the logic and database communications.

Using a framework, each team will be working separately at the same time to attain the project objective to complete the website. PHP frameworks that rely on MVC (Model-View-Controller) architecture makes it possible for the entire website application to be broken down into 3 modules. Each of these modules can, in turn, be easily updated, managed and improved upon by each team without necessarily interfering with other modules.

These 3 modules handle the following web development/designing tasks:

  1. Model – data handling (database communication) and management section of the web application.
  2. View – the view is the design layer of the website.
  3. Controller – the business logic and PHP code to accomplish the website functionality/features.

It is not necessary to use a PHP framework in every PHP website project; however, using a PHP framework does have some benefits, such as:

1.) Separating Logic from Presentation – makes the website source code easier to maintain, manage and update.

If you need to change the templates, you will only be dealing with the markup affecting the design and not the PHP code that controls the logic. This implies that the design is “clearly” isolated from the PHP code.

2.) Speeding up the development of web applications – a framework already provides all the necessary elements of a website. These include sessions, HTML sanitization/input validation, database interfaces, etc. It only requires a very simple configuration/installation (like a copy and paste operation) and your project can be completed within a reasonable time frame. Working without a framework can cost a lot of time in the development process, because everything must be created from scratch.

This article will examine 7 great and lightweight PHP frameworks released in open source.

Criteria of a Good PHP Framework

There are so many PHP frameworks that it can be hard to keep track of them all. Some are already very popular, while others are relatively new and unknown. Whatever the case, when selecting a good PHP framework, make sure it satisfies the following criteria:

  1. Speed/performance – this is likely the most important criteria. A super-fast framework can have huge impact on your website success because it translates into better user experiences and a faster website. Website performance in terms of speed is now a factor in the Google search engine rankings: http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html
  2. Lightweight – the framework files are light and reasonable in size. In this case, Zend framework is too heavy to be classified as lightweight.
  3. Flexibility in hosting – is it OK to install the framework normally in a shared hosting environment or does it require a VPS to operate efficiently? Most lightweight PHP Frameworks operate very well with shared hosting although they have different speed performances which will be examined thoroughly in this article.
  4. Security – are inputs thouroughly sanitized?
  5. PHP supported versions – does it support the latest PHP versions?
  6. Database support – does it support MySQL or SQLite? These databases are available in most hosting companies using PHP.
  7. WYSIWYG Design support – “What you see is what you get” is important to ease the design of HTML templates.
  8. Documentation – does the framework already have complete documentation for its users?

Of the seven criteria, this article will examine only the speed and performance. The following are the seven PHP frameworks to be tested:

  1. Cakephp-1.3.7: http://cakephp.org/
  2. CodeIgniter_2.0.0: http://codeigniter.com/
  3. Symfony 2: http://www.symfony-project.org/
  4. yii-1.1.6.r2877: http://www.yiiframework.com/
  5. RainFramework 2.3: http://www.rainframework.com/
  6. Doophp 1.4.1: http://www.doophp.com/
  7. Kohana-3.1: http://kohanaframework.org/

{mospagebreak title=Benchmarking PHP Frameworks}

Benchmarking Methodology

First Test: Hardware and software used:
Mac OS X/10.6.7
Processor 2.5 GHz Intel Core Duo
Memory 2 GB 667 MHz DDR2 SDRAM
Macintosh HD

Second Test: Hardware and software used:
Intel Pentium4 2.4 Ghz Processor
Linux/Ubuntu 10.04 Operating system
Apache server version (XAMPP): Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
Local test folders in encrypted sector.

Load Test Factors:

In all of the tests, we will be using the Apache Bench utility (ab). To simulate a practical scenario the following load testing factors will be employed:

Number of Connections: 500
Number of Concurrent users: 50

Note: No caching implemented.

Methods employed for First Test:

Step 1.) Download these benchmarking files to be used in this article: http://bit.ly/inWQQa or this URL: http://cid-c3bc6a3c5463e218.office.live.com/self.aspx/.Public/php%5E_framework%5E_test.zip

Step 2.) Right click and extract them.
Step 3.) Copy all of those files to your test server. Make sure the path is right; for example benchmark.php must be accessible as http://localhost/benchmark.php in your browser. Below are the localhost path of each of these frameworks to be tested:

Cakephp-1.3.7: http://localhost/cakephp-1.3.7/index.php/hello
CodeIgniter_2.0.0: http://localhost/CodeIgniter_2.0.0/index.php/
Symfony 2: http://localhost/symfony-2.0/web/app.php/hello 
yii-1.1.6.r2877: http://localhost/yii-1.1.6.r2877/demos/helloworld/
RainFramework 2.3: http://localhost/rainframework%202.3/ajax.php/hello
Doophp 1.4.1: http://localhost/doophp-1.4.1/app/
Kohana-3.1: http://localhost/kohana-3.1/index.php/welcome

Step 4.) Before running the benchmark, try executing all of the above paths provided above in your browser to make sure they output “Hello World”.

Step 5.) If the output is OK, you are now ready to start the benchmark – clear all the browser cache and history. Close the browser, then restart again. Close all other running applications in your computer. Make sure only this test is running.

Step 6.) Copy and paste this URL to the browser: http://localhost/benchmark.php

It will take some time, because there are around 7 frameworks to be tested. Wait until the script provides some output.

Methods employed for the Second Test:

Step 1.) Follow Step 1 to 6 of the First step procedure.
Step 2.) Do 3 trials for each framework, then reboot the server.
Step 3.) Average the results of the 3 trials.

{mospagebreak title=PHP Framework Benchmarking Test Results}

Results of the First Test and Second Test

Below are the results for the first test:


Doophp 1.4.1 is the fastest of the 7 tested PHP frameworks, followed by Rainframework and then CodeIgniter.

Below are the results for the second test:

This time, on a Linux machine, Rainframework is the fastest PHP framework, followed by Doophp, then Codeigniter.

Results of the Third Test (Command Line in Linux)

The first and second test were done using a PHP script and using the PHP Exec function to execute ab. Now the Apache benchmark utility will be installed on Ubuntu OS independent on the XAMPP localhost and PHP. The tests are carried out using a command line method, for example for CakePHP the localhost URL: Cakephp-1.3.7: http://localhost/cakephp-1.3.7/index.php/hello

The command line test method will be:

ab -n 500 -c 50 http://localhost/cakephp-1.3.7/index.php/hello 

Below are the detailed steps:

Step1.) Install Apache2 utils in Ubuntu to be used in benchmarking (if you don’t have it already):

codex-m@codex-m-desktop:~$ sudo apt-get install apache2-utils

Step2.) Execute all the benchmark tests for all the PHP frameworks and reboot the server for each trial.

Step3.) Gather the results and average them.

Below are the results of the third test:

RainFramework is on top, followed by Doophp with 543 ms, and CodeIgniter with 888ms.

Final Advice: There is more to consider than speed when selecting a PHP framework; other factors such as security, ease of installation and database support have to be examined as well. Other frameworks may be slower but have greater and wider community support, in case you have some trouble with the framework there are lots of users that could help who have working experience with that framework. This is true with CakePHP, Symfony and Zend framework, all of which are very popular among PHP developers.

One thought on “7 PHP Frameworks Tested For Speed

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye