Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.2 #41

Merged
merged 85 commits into from
Aug 2, 2023
Merged

V2.2 #41

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
4e0042b
Add public dir to fastroute
joanhey Jul 22, 2023
c51b215
Add public dir to leaf
joanhey Jul 22, 2023
0649f38
Add public dir to phroute
joanhey Jul 22, 2023
384c7b9
Add public dir to php-pure
joanhey Jul 22, 2023
e16824d
Add public dir to siler
joanhey Jul 22, 2023
c669d8b
Add public dir to slim 3.12
joanhey Jul 22, 2023
23aa73c
Add public dir to slim 4.11
joanhey Jul 22, 2023
bda8cb3
Add public dir to fatfree
joanhey Jul 22, 2023
eb6b24a
Change name to kumbia
joanhey Jul 22, 2023
f5e1a0d
Add GH action to test the frameworks
joanhey Jul 22, 2023
6b867aa
Install WRK
joanhey Jul 22, 2023
c60c448
Add sudo
joanhey Jul 22, 2023
5213e80
Create dir in www
joanhey Jul 22, 2023
874bbd2
Add sudo
joanhey Jul 22, 2023
3eee088
Add more sudo
joanhey Jul 22, 2023
b11d1c5
Install mod_php
joanhey Jul 22, 2023
24f21be
Add dir logs to fuelphp
joanhey Jul 22, 2023
1781712
Add color to check.sh
joanhey Jul 22, 2023
f60daf3
Fix green color
joanhey Jul 22, 2023
d7a0483
Fix green
joanhey Jul 22, 2023
9f374ef
Change check.sh output
joanhey Jul 22, 2023
324b948
Add exit error to check.sh
joanhey Jul 22, 2023
4960f05
Fix repeated var
joanhey Jul 22, 2023
b8a5f25
Add php extensions for Symfony
joanhey Jul 22, 2023
b2bd0c4
Render the html error
joanhey Jul 22, 2023
5f55a30
Add w3m
joanhey Jul 22, 2023
2200b04
Check: validate that exist w3m else return normal
joanhey Jul 22, 2023
ff6c07e
Clean
joanhey Jul 22, 2023
2089162
Add intl extension
joanhey Jul 22, 2023
5f1dabc
Add permissions
joanhey Jul 23, 2023
b72cf7d
Fix Laravel permissions
joanhey Jul 23, 2023
5450155
Merge pull request #13 from joanhey/public-dir
myaaghubi Jul 23, 2023
3593200
Temporally disable artisan optimize
joanhey Jul 23, 2023
a821d4d
Add name to the job
joanhey Jul 23, 2023
05ff7de
Merge pull request #16 from joanhey/gh-action
myaaghubi Jul 23, 2023
6184ff9
More colors for charts
myaaghubi Jul 23, 2023
a30fd68
Lets keep `output` dir
myaaghubi Jul 23, 2023
dead4e3
Fix status check to be compatible with #16
myaaghubi Jul 24, 2023
748950e
Remove frameworkx
myaaghubi Jul 24, 2023
8e4653c
Symfony update to v6.3
joanhey Jul 25, 2023
facd860
Change version bench config
joanhey Jul 25, 2023
67909d7
Move dir
joanhey Jul 25, 2023
293a521
Debug off
joanhey Jul 25, 2023
2159b30
Delete unnecessary vars
joanhey Jul 26, 2023
05f06fa
Show response length
joanhey Jul 26, 2023
e02e1e0
Add extra tab
joanhey Jul 26, 2023
f06272f
Revert "Add extra tab"
joanhey Jul 26, 2023
3c15e6b
Fix ouput_data.php
joanhey Jul 26, 2023
be0f200
Merge pull request #17 from joanhey/sym-6.3
myaaghubi Jul 26, 2023
32e6683
Merge pull request #19 from joanhey/resp-length
myaaghubi Jul 26, 2023
e9b57e2
Laravel 10 fix permissions
joanhey Jul 26, 2023
5cd254a
Fix clean with public dir
joanhey Jul 26, 2023
f13d1c0
CI 4.3 fix permissions
joanhey Jul 26, 2023
6b4827a
Fix Lumen permissions
joanhey Jul 26, 2023
8a797b6
Fix CI 4 clear cache
joanhey Jul 26, 2023
c5de413
Merge pull request #20 from joanhey/laravel-permissions
myaaghubi Jul 27, 2023
a0879a5
Merge pull request #23 from joanhey/lumen-permissions
myaaghubi Jul 27, 2023
a77fbb0
Merge pull request #21 from joanhey/fix-public-dir
myaaghubi Jul 27, 2023
23aaa28
Fix Symfony 5.4 permissions
joanhey Jul 27, 2023
78e2dfc
Fix Symfony 6.3 permissions
joanhey Jul 27, 2023
e72f961
Add the URL to check.sh
joanhey Jul 27, 2023
dd4dc88
Add the URL to check.sh
joanhey Jul 27, 2023
c098c05
Show tabulated data
joanhey Jul 27, 2023
1c65791
Merge branch 'add-url' of https://github.com/joanhey/PHP-Frameworks-B…
joanhey Jul 27, 2023
b988c27
Delete initial space to work with the status
joanhey Jul 27, 2023
588986d
Add more space to the number of bytes
joanhey Jul 27, 2023
4e02458
Remove "URL:"
joanhey Jul 27, 2023
1bedf86
Revert "Remove "URL:""
joanhey Jul 28, 2023
034baf5
Merge pull request #22 from joanhey/codeigniter-permissions
myaaghubi Jul 28, 2023
0d6954a
Merge pull request #24 from joanhey/symfony5.4-perm
myaaghubi Jul 28, 2023
2fb8af2
Merge pull request #25 from joanhey/symfony6.3-perm
myaaghubi Jul 28, 2023
34d3ae4
Remove "URL:"
joanhey Jul 28, 2023
87a8ae6
Merge pull request #26 from joanhey/add-url
myaaghubi Jul 28, 2023
97d5b6a
Fix Laminas permissions
joanhey Jul 28, 2023
11e42a9
Merge pull request #29 from joanhey/laminas-perm
myaaghubi Jul 28, 2023
a0c5062
Delete siler-1.7.9 directory
myaaghubi Jul 28, 2023
fb88615
Siler removed
myaaghubi Jul 28, 2023
163d2c0
Add tests badge in README
joanhey Jul 28, 2023
df84dff
Merge pull request #34 from joanhey/tests-badge
myaaghubi Jul 29, 2023
b29dd63
Fix PHP Version Close #35 & OPCache Rest Close #36
myaaghubi Jul 30, 2023
8ee3952
A bug fix with `-c` | `--clean`
myaaghubi Jul 31, 2023
79b0ee0
Delete `Slim 3`
myaaghubi Aug 1, 2023
57c2eb9
Make `clear-cache.sh` quiet
myaaghubi Aug 1, 2023
07275bc
Table updated for `symfony-6.3` & `symfony-5.4`
myaaghubi Aug 1, 2023
9836910
Update shots for `symfony-6.3` and `symfony-5.4`
myaaghubi Aug 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test PHP benchmark
on: [ push, pull_request ]

jobs:
setup:
name: Check PHP frameworks
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v3

- name: Install WRK
run: sudo apt-get install wrk w3m

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, ctype, iconv, intl
coverage: none

- name: Install Apache mod_php
run: |
LC_ALL=C.UTF-8 sudo apt-add-repository http://ppa.launchpad.net/ondrej/php/ubuntu
sudo apt install libapache2-mod-php8.2
sudo a2enmod php8.2 rewrite
shell: bash

- name: Setup frameworks
run: bash setup.sh

- name: Copy files to web root
run: |
sudo mkdir /var/www/html/PHP-Frameworks-Bench
sudo cp -R ./* /var/www/html/PHP-Frameworks-Bench/
sudo chown -R www-data:www-data /var/www/html

- name: Restart apache server
run: sudo service apache2 restart

- name: Check frameworks
run: bash check.sh

5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/output/
vendor/
#/*/code/
/output/*
vendor/
1 change: 1 addition & 0 deletions 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.2.8
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PHP Frameworks Bench
![GitHub release (latest by date)](https://img.shields.io/github/v/release/myaaghubi/PHP-Frameworks-Bench?color=purpol) ![GitHub](https://img.shields.io/github/license/myaaghubi/PHP-Frameworks-Bench?color=green)
[![Test PHP benchmark](https://github.com/myaaghubi/PHP-Frameworks-Bench/actions/workflows/test.yml/badge.svg)](https://github.com/myaaghubi/PHP-Frameworks-Bench/actions/workflows/test.yml) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/myaaghubi/PHP-Frameworks-Bench?color=purpol) ![GitHub](https://img.shields.io/github/license/myaaghubi/PHP-Frameworks-Bench?color=green)

This project attempts to measure the minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world.

Expand Down Expand Up @@ -56,18 +56,16 @@ These are my benchmarks, not yours. **I encourage you to run on your (production
|phroute-2.2 | 4,303.07| 44.4| 0.58| 1.4|
|leaf-3.3 | 1,576.68| 16.3| 1.10| 2.6|
|fatfree-3.8.1 | 1,512.30| 15.6| 1.67| 4.0|
|siler-1.7.9 | 1,416.80| 14.6| 1.17| 2.8|
|slim-3.12 | 1,061.05| 10.9| 1.40| 3.3|
|slim-4.11 | 805.51| 8.3| 1.57| 3.7|
|ubiquity-2.4.x.dev | 726.70| 7.5| 1.64| 3.9|
|silex-2.3 | 558.07| 5.8| 2.16| 5.1|
|yii-2.0-basic | 508.32| 5.2| 2.57| 6.1|
|fuelphp-1.9 | 450.65| 4.6| 2.51| 6.0|
|lumen-10.0 | 352.94| 3.6| 3.49| 8.3|
|codeigniter-4.3 | 324.27| 3.3| 3.50| 8.3|
|symfony-5.4 | 319.55| 3.3| 3.82| 9.1|
|symfony-6.2 | 314.21| 3.2| 3.89| 9.2|
|symfony-5.4 | 311.74| 3.2| 3.82| 9.1|
|laminas-2.0 | 309.30| 3.2| 3.50| 8.3|
|symfony-6.3 | 290.69| 3.0| 3.91| 9.3|
|cakephp-4.4 | 262.25| 2.7| 4.49| 10.7|
|laravel-10.0 | 96.97| 1.0| 11.99| 28.5|

Expand Down Expand Up @@ -181,15 +179,13 @@ For frameworks, I considered the official repos:
* [CodeIgniter](https://github.com/codeigniter4/CodeIgniter4)
* [FastRoute](https://github.com/nikic/FastRoute)
* [FatFree](https://github.com/bcosca/fatfree)
* [FrameworkX](https://github.com/clue/framework-x)
* [FuelPHP](https://github.com/fuelphp/fuelphp)
* [KumbiaPHP](https://github.com/KumbiaPHP/KumbiaPHP)
* [Laminas](https://github.com/laminas)
* [Laravel](https://github.com/laravel/laravel)
* [Leaf](https://github.com/leafsphp/leaf)
* [Lumen](https://github.com/laravel/lumen)
* [PhRoute](https://github.com/mrjgreen/phroute)
* [Siler](https://github.com/leocavalcante/siler)
* [Silex](https://github.com/silexphp/Silex)
* [Slim](https://github.com/slimphp/Slim)
* [Symfony](https://github.com/symfony/symfony)
Expand Down
4 changes: 1 addition & 3 deletions base/_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ benchmark () {
url_status=$(bash check.sh -t "$fw")

# find 'done'
status=${url_status%%done*}
status=${url_status%%✔ ${fw}*}

# if the index of 'done' be equal to
# the length of the url_status then
Expand Down Expand Up @@ -90,6 +90,4 @@ benchmark () {
fi

echo "$url" >> "$url_file"

echo
}
13 changes: 7 additions & 6 deletions base/hello_world.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ if [ -f "$url_file" ]; then
mv "$url_file" "$url_file.old"
fi


phpv=`php -r 'echo phpversion();'`
echo "/------- PHP $phpv -------/"
phpc=`curl -s "$base/libs/php_config.php"`
echo "/------- PHP Config -------/"
echo "$phpc"

for fw in `echo $param_targets`
do
if [ -d "$fw" ]; then
echo "/------- $fw -------/"
echo "\n/------- $fw -------/"

# read -p "Continue to $fw (y/n)?" choice
# case "$choice" in
Expand All @@ -54,7 +54,7 @@ do

if [ "$param_clean" = true ]; then
bash clean.sh
bash setup.sh "$fw"
bash setup.sh -t "$fw"
fi

# read -p "Continue to benchmark (y/n)?" choice
Expand All @@ -67,7 +67,8 @@ do
# fi

# reset the opcache
php ./libs/reset_opcache.php
opcacherest=`curl -s "$base/libs/reset_opcache.php"`
echo "$opcacherest"

if [ "$param_restart_apache" = true ]; then
echo 'systemctl restart apache2'
Expand Down
9 changes: 3 additions & 6 deletions benchmark.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,18 @@ cakephp-4.4
codeigniter-4.3
fastroute-1.3
fatfree-3.8.1
frameworkx-dev
fuelphp-1.9
kumbiaphp-1.1
kumbia-1.1
laminas-2.0
laravel-10.0
leaf-3.3
lumen-10.0
phroute-2.2
pure-php
siler-1.7.9
silex-2.3
slim-3.12
slim-4.11
symfony-5.4
symfony-6.2
symfony-6.3
ubiquity-2.4.x.dev
yii-2.0-basic
"
"
1 change: 1 addition & 0 deletions benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ done

sh ./base/hello_world.sh

echo ''
php ./libs/show_results_table.php
26 changes: 21 additions & 5 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,36 @@
. ./benchmark.config
. ./base/option_target.sh

# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

FAIL=0

for fw in `echo $param_targets`
do
if [ -d "$fw" ]; then
echo -n "/------- $fw: checking... "
. "$fw/_benchmark/hello_world.sh"

url_output=$(curl -s "$url")

# expected to get the Hello World! + libs/output_data.php
if ! [[ "$url_output" =~ ^('Hello World!')(.*)(([0-9]*):(([0-9]+([.][0-9]*)?|[.][0-9]+)):([0-9]*))$ ]]; then
echo -e "error: \n$url"
echo "$url_output"
echo -e "${RED}❌ $fw ${NC}"
echo "$url"

if [ -x "$(command -v w3m)" ]; then
echo "$url_output" | w3m -dump -T text/html
else
echo "$url_output"
fi

FAIL=1
else
echo "done."
printf "%-34b %4s bytes %s\n" "${GREEN}✔ $fw ${NC}" "${#url_output}" "$url"
fi
fi
done
done

exit $FAIL
2 changes: 1 addition & 1 deletion codeigniter-4.3/_benchmark/clear-cache.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# clear cache
sudo rm -rf writable/cache/*
rm -rf writable/cache/*
echo -e "done"
2 changes: 1 addition & 1 deletion codeigniter-4.3/_benchmark/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ yes|cp -r _benchmark/codeigniter/* ./

# some enhancements
composer install --no-dev -o
sudo chown -Rv www-data writable
chmod -R o+w writable
rm ./public/.htaccess
2 changes: 1 addition & 1 deletion codeigniter-4.3/_benchmark/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ yes|cp -r _benchmark/codeigniter/* ./

# some enhancements
composer install --no-dev -o
sudo chown -Rv www-data writable
chmod -R o+w writable
rm ./public/.htaccess
2 changes: 1 addition & 1 deletion fastroute-1.3/_benchmark/clean.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
rm -rf !("_benchmark"|"Controllers"|"composer.json"|"index.php")
rm -rf !("_benchmark"|"Controllers"|"composer.json"|"public")
find -path './.*' -delete
2 changes: 1 addition & 1 deletion fastroute-1.3/_benchmark/hello_world.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
url="$base/$fw/index.php/hello/index"
url="$base/$fw/public/index.php/hello/index"
4 changes: 2 additions & 2 deletions fastroute-1.3/index.php → fastroute-1.3/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://github.com/nikic/FastRoute#usage
// Here's a basic usage example:

require __DIR__.'/vendor/autoload.php';
require __DIR__.'/../vendor/autoload.php';


$dispatcher = FastRoute\simpleDispatcher(function(FastRoute\RouteCollector $r) {
Expand All @@ -22,7 +22,7 @@

// https://github.com/nikic/FastRoute/issues/110#issuecomment-273760186
// Strip prefix
$prefix = '/PHP-Frameworks-Bench/fastroute-1.3';
$prefix = '/PHP-Frameworks-Bench/fastroute-1.3/public';
if ($prefix !== '' && strpos($uri, $prefix) === 0) {
$uri = substr($uri, strlen($prefix));
}
Expand Down
2 changes: 1 addition & 1 deletion fatfree-3.8.1/_benchmark/clean.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
rm -rf !("_benchmark"|"Controllers"|"composer.json"|"index.php")
rm -rf !("_benchmark"|"Controllers"|"composer.json"|"public")
find -path './.*' -delete
2 changes: 1 addition & 1 deletion fatfree-3.8.1/_benchmark/hello_world.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
url="$base/$fw/index.php/hello/index"
url="$base/$fw/public/index.php/hello/index"
2 changes: 1 addition & 1 deletion fatfree-3.8.1/index.php → fatfree-3.8.1/public/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require 'vendor/autoload.php';
require '../vendor/autoload.php';

$f3 = \Base::instance();

Expand Down
14 changes: 0 additions & 14 deletions frameworkx-dev/Controllers/HelloWorldController.php

This file was deleted.

3 changes: 0 additions & 3 deletions frameworkx-dev/_benchmark/clean.sh

This file was deleted.

2 changes: 0 additions & 2 deletions frameworkx-dev/_benchmark/setup.sh

This file was deleted.

2 changes: 0 additions & 2 deletions frameworkx-dev/_benchmark/update.sh

This file was deleted.

10 changes: 0 additions & 10 deletions frameworkx-dev/composer.json

This file was deleted.

22 changes: 0 additions & 22 deletions frameworkx-dev/public/index.php

This file was deleted.

Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions kumbiaphp-1.1/_benchmark/clear-cache.sh

This file was deleted.

2 changes: 1 addition & 1 deletion laminas-2.0/_benchmark/clear-cache.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
# clear cache
sudo rm -rf data/cache/*
rm -rf data/cache/*
echo -e "done"
1 change: 1 addition & 0 deletions laminas-2.0/_benchmark/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ yes|cp -rf _benchmark/laminas/. ./

# some enhancements
composer install --optimize-autoloader --no-dev
chmod -R o+w data/cache
rm ./public/.htaccess
1 change: 1 addition & 0 deletions laminas-2.0/_benchmark/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ yes|cp -rf _benchmark/laminas/. ./

# some enhancements
composer install --optimize-autoloader --no-dev
chmod -R o+w data/cache
rm ./public/.htaccess
Loading