Perf icon

Source code

All benchmarks source codes are available on github.com/phpbenchmarks.

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 init_benchmark.sh, 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 README.md.
Perf icon

Template engine installation

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

Template engine installation repository

cd /var/www
git clone https://github.com/phpbenchmarks/plates.git
cd plates
git checkout -b plates_3.3_prepare
# Installez votre moteur de template
composer require league/plates:3.3.*
composer update

Create first commit with default template engine installation

git add .
git commit -m "Default installation"
git push origin plates_3.3_prepare

Common repository

cd /var/www
git clone https://github.com/phpbenchmarks/plates-common.git
cd plates-common
git checkout -b plates_3_prepare
touch README.md
git add README.md
git commit -m "Create branch"
git push origin plates_3_prepare
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):
  • Create a layout layout.html, who will be extended by overload.html template
  • 2 functions, who contains echo 'PHP Benchmarks', in an external file and call them
  • 2 macros, who contains echo 'PHP Benchmarks', in an external file and call them
  • 2 strings escaping for HTML
  • 2 strings escaping for JS
  • 2 variables assignment (text should contains HTML) and echo their content without escaping the HTML
  • 2 display of unknown variables (should not throw an exception)
  • Create a OverloadObject class, pass an instance to overload.html and display phpBenchmarks() method call on this object, who return PHP Benchmarks
  • 2 templates inclusions, pass them a variable and display it
  • 2 blocks into layout.html, overloaded into overload.html who displays PHP Benchmarks
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!