Perf icon

Source code

All benchmarks source codes are available on

Each benchmarked tool source code is divided in 2 repositories.
Example with Twig :
  • phpbenchmarks/twig: Twig installation, without benchmark source code.
    • A branch per minor Twig version, and per benchmark. Example: twig_2.4_hello-world.
    • Contains, with init() function who initiate benchmark: composer install, clear caches etc.
    • Twig benchmarked version as dependency (forced major and minor, example 2.4.*) and phpbenchmark/twig-common.
  • phpbenchmarks/twig-common: benchmark source code.
    • Final benchmark source code should be compatible with all minors versions of a major version. Example : 2.*.
    • A branch per major version and per benchmark. Example: twig_2_hello-world.
    • Versioning is explained into
Perf icon

Framework installation

Ask us to create the 2 GitHub repositories of framework you want to add.
Once repositories are created, clone them, create your branches and install the framework (Symfony 4.0 in this example).

Framework installation repository

cd /var/www
git clone
cd symfony
git checkout -b symfony_4.0_prepare
# Install your framework
composer create-project symfony/skeleton .
composer update

Create first commit with default framework installation

git add .
git commit -m "Default installation"
git push origin symfony_4.0_prepare

Common repository

cd /var/www
git clone
cd symfony-common
git checkout -b symfony_4_prepare
git add
git commit -m "Create branch"
git push origin symfony_4_prepare

Add phpbenchmarks/benchmark-rest-data dependency

cd /var/www/symfony
composer require phpbenchmarks/benchmark-rest-data 1.0.0

Symlink between this 2 repositories

To make code and commits easiest, we can create a symlink between this 2 repositories:
cd /var/www/symfony
composer require symfony-common dev-symfony_4_prepare
rm -rf vendor/phpbenchmarks/symfony-common
ln -s /var/www/symfony/symfony-common vendor/phpbenchmarks/symfony-common
Perf icon

Features for all benchmarks

All source code should be into symfony-common, symfony project should only contains framework installation and configuration (prod env).

To create each benchmarks, you should add this features (or some of them, juste tell us features aren't implemented):
  • 2 Foo and Bar entities, with mapped fields into ORM for MySQL - Détails
  • Validators on Foo entity - Détails
  • 2 translation keys, into 3 languages(fr_FR, en_GB and en) - Détails
  • 2 listeners sur l'événement phpbenchmarks, dont le callback ne fait rien
  • 2 routes : /benchmark/foo et /benchmark/bar
  • 1 controller, called by first route, with some features - Détails
  • 2 services, who don't do anything, registered into Container (or equivalent)
  • Create a bundle, module, plugin (or another name according to your framework) who is registered into framework but don't do anythig
Perf icon

That's all folks !

Send source code to GitHub, and tell us you have finished via contact form.

PHP benchmarks appreciate all participations, even if you don't implement all features!