The PHP frameworks continue to battle each other over supremacy. One important criterion is speed. This quality can be estimated by the function call count required to get a message on screen.This blog tested 6 frameworks.

The platform was Windows10/Xampp. For each framework the easiest available skeleton application was generated that at a minimum displayed “hello world” or something similar on screen. The function call count was then returned by Xdebug. For comparison the average browser speed was measured in Firefox with Firebug.

Laravel

laravel install 5.1.33
Run : composer create-project laravel/laravel blog “5.1.*”

The function call count is 7781 which is up from 3386 in the 4.2.0 version

Zend Framework 3

See installlation notes here.

The number is 7325 down from 7711 for version 2.5

Symfony

Run: composer create-project symfony/framework-standard-edition
will install 3.2.1

The function call count is 4667 down from 20500 for version 2.5 but with extensive caching. Un-cached the count can be up to 400,000… (the xdebug count varies)

Yii

Installing 2.0.10

composer global require "fxp/composer-asset-plugin:^1.2.0"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic

Function count 2310 (559 ms)

Silex

Silex is a light-weight Symfony clone.

Run: composer require silex/silex “~2.0”

Then create a minimal bootstrap with

// web/index.php
require_once __DIR__.'/../vendor/autoload.php';
$app = new Silex\Application();
$app->get('/', function() use($app) {
    return 'Hello World!';
});
$app->run();

The function call count registered was 1823

Phalcon

Unlike the other frameworks Phalcon is a PHP extension written in C. No need to look for a PHP library! Installation tips:

check phpinfo() for architecture – compiler – php version so that you know what version to load, for now:

Phalcon 3.0.3 – Windows x86 for PHP 5.6.0 (vc11)

otherwise the extension won’t run

place the php_phalcon.dll  file in c:\xampp\php\ext and restart Apache.
In phpinfo() check for

phalcon
Web framework delivered as a C-extension for PHP

we still need a skeleton:

git clone https://github.com/phalcon/skeleton-single.git

The number of function calls here a measly  181 (!) in 31 ms.

The function call count correlated nicely with the browser speed with a correlation coefficient of 0.92.

battleoftheframeworks

Advertisements