{"id":14966480,"url":"https://github.com/myaaghubi/php-frameworks-bench","last_synced_at":"2025-04-05T19:11:33.998Z","repository":{"id":37526363,"uuid":"417852486","full_name":"myaaghubi/PHP-Frameworks-Bench","owner":"myaaghubi","description":"A library to make benchmarks from PHP frameworks.","archived":false,"fork":false,"pushed_at":"2025-02-13T08:37:10.000Z","size":5210,"stargazers_count":120,"open_issues_count":2,"forks_count":4,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-05T19:11:11.132Z","etag":null,"topics":["benchmark","cakephp","codeigniter","fastroute","fatfree","fuelphp","kumbiaphp","laminas","laravel","leaf","lumen","performance","php","phroute","pure-php","siler","silex","slim","symfony","yii"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myaaghubi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-16T14:28:47.000Z","updated_at":"2025-03-02T19:04:46.000Z","dependencies_parsed_at":"2024-03-23T07:24:42.279Z","dependency_job_id":"29700357-52d1-4302-b109-59d88d88b7bb","html_url":"https://github.com/myaaghubi/PHP-Frameworks-Bench","commit_stats":{"total_commits":216,"total_committers":4,"mean_commits":54.0,"dds":0.5601851851851851,"last_synced_commit":"3358a167cf599cdc9a3f487bc48a194082085381"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myaaghubi%2FPHP-Frameworks-Bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myaaghubi%2FPHP-Frameworks-Bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myaaghubi%2FPHP-Frameworks-Bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myaaghubi%2FPHP-Frameworks-Bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myaaghubi","download_url":"https://codeload.github.com/myaaghubi/PHP-Frameworks-Bench/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","cakephp","codeigniter","fastroute","fatfree","fuelphp","kumbiaphp","laminas","laravel","leaf","lumen","performance","php","phroute","pure-php","siler","silex","slim","symfony","yii"],"created_at":"2024-09-24T13:36:27.272Z","updated_at":"2025-04-05T19:11:33.964Z","avatar_url":"https://github.com/myaaghubi.png","language":"PHP","readme":"# PHP Frameworks Bench\n[![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)\n\n\n📊 This project attempts to measure the minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world.\n\nSo I think the minimum should not include:\n\n* cost of template engine\n* cost of database manipulation\n* cost of debugging information\n\nBenchmarking on components like template engines or ORM/Database libraries is out of the scope of this project.\n\n\n- [PHP Frameworks Bench](#php-frameworks-bench)\n  - [Benchmarks](#benchmarks)\n    - [Latest](#latest)\n    - [OPCache On/Off](#opcache-on)\n  - [How to Benchmark](#how-to-benchmark)\n  - [Docker](#docker)\n  - [Commands](#commands)\n  - [Benchmarking Policy](#benchmarking-policy)\n  - [Add Your Framework](#add-your-framework)\n  - [Donate](#-donate)\n  - [References](#references)\n  - [License](#license)\n\n\n## Benchmarks\n\n### Latest\n\n#### Environment\n\nFor `PHP 8.3` check out [this link](https://github.com/myaaghubi/PHP-Frameworks-Bench/tree/92cce05b3f6cf0aa33a06c3f13d8dd0c706f3b6c).\n\nFor `PHP 8.2` check out [this link](https://github.com/myaaghubi/PHP-Frameworks-Bench/tree/163d2c0eb7862cf3c14479913435cb90ec7d6f0b).\n\n* Ubuntu 24.04 LTS x86_64\n  * PHP 8.4.3\n  * OPCache Off\n  * Apache 2.4.58\n  * WRK 4.2.0 (5 min)\n  * CPU Core i7-3770K/4.4Ghz\n  * Memory 16G \n\n\n#### Results (2025/2/7)\n\nThese are my benchmarks, not yours. **I encourage you to run on your -production equivalent- environments.**\n\n![Frameworks Benchmark Results Graph Throughput](screenshots/php-frameworks-bench-throughput.png)\n![Frameworks Benchmark Results Graph Memory](screenshots/php-frameworks-bench-memory.png)\n![Frameworks Benchmark Results Graph Execution Time](screenshots/php-frameworks-bench-exectime.png)\n![Frameworks Benchmark Results Graph Included Files](screenshots/php-frameworks-bench-includedfiles.png)\n\n|framework          |requests per second (rps)|relative (rps)|peak memory|relative (mem)|\n|-------------------|------------------------:|-------------:|----------:|-------------:|\n|pure-php           |                25,833.28|         409.4|       0.42|           1.0|\n|kumbia-1.2         |                 5,681.12|          90.0|       0.54|           1.3|\n|fastroute-1.3      |                 4,262.94|          67.6|       0.56|           1.3|\n|phroute-2.2        |                 3,949.48|          62.6|       0.58|           1.4|\n|fatfree-3.9        |                 1,364.24|          21.6|       1.72|           4.1|\n|leaf-3.11          |                 1,298.60|          20.6|       1.18|           2.8|\n|slim-4.14          |                   741.19|          11.7|       1.59|           3.8|\n|yii-2.0-basic      |                   527.72|           8.4|       2.60|           6.2|\n|silex-2.3          |                   512.44|           8.1|       2.28|           5.4|\n|lumen-10.0         |                   301.01|           4.8|       3.78|           9.0|\n|symfony-5.4        |                   281.95|           4.5|       3.84|           9.1|\n|codeigniter-4.6    |                   274.93|           4.4|       3.93|           9.4|\n|symfony-7.0        |                   261.52|           4.1|       4.20|          10.0|\n|symfony-6.4        |                   254.35|           4.0|       4.26|          10.1|\n|cakephp-5.1        |                   222.48|           3.5|       4.96|          11.8|\n|laravel-10.3       |                    76.35|           1.2|      13.82|          32.9|\n|laravel-11.0       |                    63.10|           1.0|      16.19|          38.5|\n\n\n#### OPCache On\nCheck out the video for more information.\n\n[![Results with OPCache On/Off \u0026 How to add your framework](http://img.youtube.com/vi/Dk8YHQZ6jfY/0.jpg)](http://www.youtube.com/watch?v=Dk8YHQZ6jfY)\n\n\n## How to Benchmark\n\nIf you want to have benchmarks on `PHP extension frameworks` like `Phalcon`, you need to install the extension first, based on its own documentation.\n\n1- Download \u0026 Setup:\n\n```bash\n# make sure to put it in the root of your web path\n$ git clone https://github.com/myaaghubi/PHP-Frameworks-Bench.git\n\n$ cd PHP-Frameworks-Bench\n\n# optional\n$ nano config\n\n# run the setup \u0026 follow the progress\n$ yes | bash setup.sh\n```\n\n2- Make sure everything is ok:\n\n```bash\n$ bash check.sh\n# bash check.sh -t pure-php\n# ✔ pure-php\n```\n\n3- Run benchmarks:\n\n```bash\n# bash benchmark.sh --help\n$ bash benchmark.sh\n```\n\n4- Check the results:\n- web:\n\n  \u003chttp://127.0.0.1/PHP-Frameworks-Bench/\u003e\n\n- terminal:\n  ```bash\n  # bash results.sh --help\n  bash results.sh\n  ```\n\n\n## Docker\n\nResults with docker may or may not be reliable but in a situation you can use it like:\n\n1- Change the `base` in `config` on the right port(`8080` considered):\n\n```ini\nbase=\"http://127.0.0.1:8080/PHP-Frameworks-Bench\"\n...\n```\n\n2- Run/download the docker:\n\n```bash\n$ bash docker-apache.sh\n```\n\n3- Run the benchmark:\n\n```bash\n# run it in another terminal\n$ bash benchmark.sh\n```\n\n\n## Commands\n\n```bash\n# use bash benchmark.sh --help\n$ bash benchmark.sh -f -rapache -t pure-php\n\n# run composer update for frameworks\n$ bash update.sh\n\n# to clean them all\n# trouble? run it then\n# you can use `bash setup.sh` again\n$ bash clean.sh\n\n# clear the cache of frameworks\n$ bash clear-cache.sh\n\n# show the results table\n$ bash results.sh\n```\n\nTo specify frameworks, put them with `-t ...` after each command:\n\n```bash\n# supported for `setup.sh`, `benchmark.sh`, `update.sh`, `clean.sh`, and `clear-cache.sh`\n# bash benchmarks.sh --help\n$ bash benchmark.sh -t laravel-10.2/ slim-4.12/ ...\n...\n```\n\n\n## Add Your Framework\nCheck out the [Benchmarking Policy](#benchmarking-policy), to get more information watch the video [OPCache On/Off](#opcache-on).\n\n\n## Benchmarking Policy\n\n* Use `composer` to install frameworks according to their official documentation.\n* Use the default configuration.\n  * Minimum changes on frameworks to have benchmarks.\n  * Don't remove any components/configurations even if there is no use for them.\n* Include a `controller` class to get the `Hello World!` for each, based on the default template of each framework for `controllers`.\n* Turn off the `debug` mode and set the environment to `production` mode.\n* General optimization for the production environment, like `--optimize-autoloader` for the `composer`.\n\nSome frameworks are optimized more than others, so some developers may think using default configuration is not fair. The dept of optimizing a framework depends on the skills/experiences of the developer too, so it's the rabbit hole and nonsense for ranking. Please **note** optimizing for the `Hello World` is not acceptable! Building the fastest `Hello World` application is not the goal of this project. I think the default configuration of frameworks is a good starting point to have a ranking.\n\nIf you find something wrong in my code, feel free to send a `PR`. \n\n\n## 🍔 Donate\nDon't forget to donate if you find it useful ☕ 🍺 🍸 🍔\n\nETH: 0x0ADd51D6855d2DF11BB5F331A3fa345c67a863b2\n\n![Ethereum](screenshots/ethereum.jpg?raw=true \"Ethereum\")\n\n\n## References \nNote: This project is based on\n[php-framework-benchmark](https://github.com/kenjis/php-framework-benchmark), thanks to [Kenjis](https://github.com/kenjis). It is very old and abandoned, so I decided to split it from the origin and change/update it separately.\n\n🙏 Thanks to contributors: \n\n- [Joan Miquel](https://github.com/joanhey)\n\n- [Rostunov Sergey](https://github.com/stdex)\n\n\n\n📄 For frameworks, I considered the official repos:\n* [CakePHP](https://github.com/cakephp/cakephp)\n* [CodeIgniter](https://github.com/codeigniter4/CodeIgniter4)\n* [FastRoute](https://github.com/nikic/FastRoute)\n* [FatFree](https://github.com/bcosca/fatfree)\n* [FuelPHP](https://github.com/fuelphp/fuelphp)\n* [KumbiaPHP](https://github.com/KumbiaPHP/KumbiaPHP)\n* [Laminas](https://github.com/laminas)\n* [Laravel](https://github.com/laravel/laravel)\n* [Leaf](https://github.com/leafsphp/leaf)\n* [Lumen](https://github.com/laravel/lumen)\n* [PhRoute](https://github.com/mrjgreen/phroute)\n* [Silex](https://github.com/silexphp/Silex)\n* [Slim](https://github.com/slimphp/Slim)\n* [Symfony](https://github.com/symfony/symfony)\n* [Ubiquity](https://github.com/phpMv/ubiquity)\n* [Yii](https://github.com/yiisoft/yii2)\n\n\n## License\n\nYou are allowed to use this plugin/project under the terms of the GNU General Public License version 2.\n\nCopyright (C) 2025 [Mohammad Yaaghubi](https://github.com/myaaghubi)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyaaghubi%2Fphp-frameworks-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyaaghubi%2Fphp-frameworks-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyaaghubi%2Fphp-frameworks-bench/lists"}