Skip to content

Commit 3358a16

Browse files
authored
Merge pull request #53 from myaaghubi/v2.4.1
V2.4.1
2 parents 09852e7 + be5f66c commit 3358a16

File tree

42 files changed

+395
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+395
-36
lines changed

.docker/apache.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.2-apache
1+
FROM php:8.3-apache
22

33
RUN apt-get update \
44
&& apt-get install -y libicu-dev

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
setup:
66
name: Check PHP frameworks
77
runs-on: ubuntu-22.04
8-
8+
99
steps:
1010

1111
- uses: actions/checkout@v3
@@ -16,15 +16,15 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: 8.2
19+
php-version: 8.3
2020
extensions: dom, curl, libxml, mbstring, zip, pcntl, ctype, iconv, intl
2121
coverage: none
2222

2323
- name: Install Apache mod_php
2424
run: |
2525
LC_ALL=C.UTF-8 sudo apt-add-repository http://ppa.launchpad.net/ondrej/php/ubuntu
26-
sudo apt install libapache2-mod-php8.2
27-
sudo a2enmod php8.2 rewrite
26+
sudo apt install libapache2-mod-php8.3
27+
sudo a2enmod php8.3 rewrite
2828
shell: bash
2929

3030
- name: Setup frameworks

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ These are my benchmarks, not yours. **I encourage you to run on your -production
6969
|lumen-10.0 | 325.27| 3.9| 3.61| 8.6|
7070
|symfony-5.4 | 309.74| 3.7| 3.77| 9.0|
7171
|codeigniter-4.4 | 302.21| 3.6| 3.62| 8.6|
72-
|symfony-6.4 | 278.58| 3.3| 4.11| 9.8|
72+
|symfony-7.0 | 286.46| 3.4| 4.07| 9.7|
73+
|symfony-6.4 | 280.83| 3.3| 4.11| 9.8|
7374
|cakephp-4.5 | 246.72| 2.9| 4.63| 11.0|
75+
|cakephp-5.0 | 243.96| 2.9| 4.74| 11.3|
7476
|laravel-10.2 | 84.19| 1.0| 13.06| 31.0|
7577

7678

7779
#### OPCache On
7880
Check out the video for more information.
81+
7982
[![Results with OPCache On/Off & How to add your framework](http://img.youtube.com/vi/Dk8YHQZ6jfY/0.jpg)](http://www.youtube.com/watch?v=Dk8YHQZ6jfY)
8083

8184

@@ -182,9 +185,7 @@ $ bash benchmark.sh -t laravel-10.2/ slim-4.12/ ...
182185

183186

184187
## Add Your Framework
185-
Check out the [Benchmarking Policy](#benchmarking-policy), to get more information watch the video
186-
187-
[OPCache On/Off](#opcache-on).
188+
Check out the [Benchmarking Policy](#benchmarking-policy), to get more information watch the video [OPCache On/Off](#opcache-on).
188189

189190

190191
## Benchmarking Policy

cakephp-4.5/_benchmark/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/sh
22
# create project
33
rm -rf _benchmark/temp
4-
composer create-project --prefer-dist cakephp/app:4.5.* ./_benchmark/temp
4+
composer create-project --prefer-dist cakephp/app:4.5.* ./_benchmark/temp --ansi
55
yes|mv ./_benchmark/temp/{.,}* ./
66

77
# have the route & controller
88
yes|cp -r _benchmark/cakephp/* ./
99

1010
# some enhancements
1111
composer dump-autoload -o
12-
composer install --no-interaction --no-dev -o
12+
composer install --no-interaction --no-dev -o --ansi
1313
rm ./webroot/.htaccess
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
/*
3+
* Local configuration file to provide any overrides to your app.php configuration.
4+
* Copy and save this file as app_local.php and make changes as required.
5+
* Note: It is not recommended to commit files with credentials such as app_local.php
6+
* into source code version control.
7+
*/
8+
return [
9+
/*
10+
* Debug Level:
11+
*
12+
* Production Mode:
13+
* false: No error messages, errors, or warnings shown.
14+
*
15+
* Development Mode:
16+
* true: Errors and warnings shown.
17+
*/
18+
/* *** PHP-Frameworks-Bench *** */
19+
'debug' => false,
20+
21+
/*
22+
* Security and encryption configuration
23+
*
24+
* - salt - A random string used in security hashing methods.
25+
* The salt value is also used as the encryption key.
26+
* You should treat it as extremely sensitive data.
27+
*/
28+
'Security' => [
29+
'salt' => env('SECURITY_SALT', '__SALT__'),
30+
],
31+
32+
/*
33+
* Connection information used by the ORM to connect
34+
* to your application's datastores.
35+
*
36+
* See app.php for more configuration options.
37+
*/
38+
'Datasources' => [
39+
'default' => [
40+
'host' => 'localhost',
41+
/*
42+
* CakePHP will use the default DB port based on the driver selected
43+
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
44+
* the following line and set the port accordingly
45+
*/
46+
//'port' => 'non_standard_port_number',
47+
48+
'username' => 'my_app',
49+
'password' => 'secret',
50+
51+
'database' => 'my_app',
52+
/*
53+
* If not using the default 'public' schema with the PostgreSQL driver
54+
* set it here.
55+
*/
56+
//'schema' => 'myapp',
57+
58+
/*
59+
* You can use a DSN string to set the entire configuration
60+
*/
61+
'url' => env('DATABASE_URL', null),
62+
],
63+
64+
/*
65+
* The test connection is used during the test suite.
66+
*/
67+
'test' => [
68+
'host' => 'localhost',
69+
//'port' => 'non_standard_port_number',
70+
'username' => 'my_app',
71+
'password' => 'secret',
72+
'database' => 'test_myapp',
73+
//'schema' => 'myapp',
74+
'url' => env('DATABASE_TEST_URL', 'sqlite://127.0.0.1/tests.sqlite'),
75+
],
76+
],
77+
78+
/*
79+
* Email configuration.
80+
*
81+
* Host and credential configuration in case you are using SmtpTransport
82+
*
83+
* See app.php for more configuration options.
84+
*/
85+
'EmailTransport' => [
86+
'default' => [
87+
'host' => 'localhost',
88+
'port' => 25,
89+
'username' => null,
90+
'password' => null,
91+
'client' => null,
92+
'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
93+
],
94+
],
95+
];
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/**
3+
* Routes configuration.
4+
*
5+
* In this file, you set up routes to your controllers and their actions.
6+
* Routes are very important mechanism that allows you to freely connect
7+
* different URLs to chosen controllers and their actions (functions).
8+
*
9+
* It's loaded within the context of `Application::routes()` method which
10+
* receives a `RouteBuilder` instance `$routes` as method argument.
11+
*
12+
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
13+
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
14+
*
15+
* Licensed under The MIT License
16+
* For full copyright and license information, please see the LICENSE.txt
17+
* Redistributions of files must retain the above copyright notice.
18+
*
19+
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
20+
* @link https://cakephp.org CakePHP(tm) Project
21+
* @license https://opensource.org/licenses/mit-license.php MIT License
22+
*/
23+
24+
use Cake\Routing\Route\DashedRoute;
25+
use Cake\Routing\RouteBuilder;
26+
27+
return function (RouteBuilder $routes): void {
28+
/*
29+
* The default class to use for all routes
30+
*
31+
* The following route classes are supplied with CakePHP and are appropriate
32+
* to set as the default:
33+
*
34+
* - Route
35+
* - InflectedRoute
36+
* - DashedRoute
37+
*
38+
* If no call is made to `Router::defaultRouteClass()`, the class used is
39+
* `Route` (`Cake\Routing\Route\Route`)
40+
*
41+
* Note that `Route` does not do any inflections on URLs which will result in
42+
* inconsistently cased URLs when used with `:plugin`, `:controller` and
43+
* `:action` markers.
44+
*/
45+
$routes->setRouteClass(DashedRoute::class);
46+
47+
/* *** PHP-Frameworks-Bench *** */
48+
$routes->connect('/hello/index', ['controller' => 'HelloWorld', 'action' => 'display', 'home']);
49+
50+
$routes->scope('/', function (RouteBuilder $builder) {
51+
/*
52+
* Here, we are connecting '/' (base path) to a controller called 'Pages',
53+
* its action called 'display', and we pass a param to select the view file
54+
* to use (in this case, templates/Pages/home.php)...
55+
*/
56+
$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
57+
58+
/*
59+
* ...and connect the rest of 'Pages' controller's URLs.
60+
*/
61+
$builder->connect('/pages/*', 'Pages::display');
62+
63+
/*
64+
* Connect catchall routes for all controllers.
65+
*
66+
* The `fallbacks` method is a shortcut for
67+
*
68+
* ```
69+
* $builder->connect('/:controller', ['action' => 'index']);
70+
* $builder->connect('/:controller/:action/*', []);
71+
* ```
72+
*
73+
* You can remove these routes once you've connected the
74+
* routes you want in your application.
75+
*/
76+
$builder->fallbacks();
77+
});
78+
79+
/*
80+
* If you need a different set of middleware or none at all,
81+
* open new scope and define routes there.
82+
*
83+
* ```
84+
* $routes->scope('/api', function (RouteBuilder $builder) {
85+
* // No $builder->applyMiddleware() here.
86+
*
87+
* // Parse specified extensions from URLs
88+
* // $builder->setExtensions(['json', 'xml']);
89+
*
90+
* // Connect API actions here.
91+
* });
92+
* ```
93+
*/
94+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types=1);
2+
3+
/*
4+
PHP-Frameworks-Bench
5+
this is a simple hello world controller to make benchmark
6+
*/
7+
8+
namespace App\Controller;
9+
10+
// such simple controller
11+
class HelloWorldController extends AppController {
12+
13+
public function display()
14+
{
15+
return $this->response->withStringBody('Hello World!');
16+
}
17+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* The Front Controller for handling every request
4+
*
5+
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
6+
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
7+
*
8+
* Licensed under The MIT License
9+
* For full copyright and license information, please see the LICENSE.txt
10+
* Redistributions of files must retain the above copyright notice.
11+
*
12+
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
13+
* @link https://cakephp.org CakePHP(tm) Project
14+
* @since 0.2.9
15+
* @license MIT License (https://opensource.org/licenses/mit-license.php)
16+
*/
17+
18+
// For built-in server
19+
if (PHP_SAPI === 'cli-server') {
20+
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
21+
22+
$url = parse_url(urldecode($_SERVER['REQUEST_URI']));
23+
$file = __DIR__ . $url['path'];
24+
if (strpos($url['path'], '..') === false && strpos($url['path'], '.') !== false && is_file($file)) {
25+
return false;
26+
}
27+
}
28+
require dirname(__DIR__) . '/vendor/autoload.php';
29+
30+
use App\Application;
31+
use Cake\Http\Server;
32+
33+
// Bind your application to the server.
34+
$server = new Server(new Application(dirname(__DIR__) . '/config'));
35+
36+
// Run the request/response through the application and emit the response.
37+
$server->emit($server->run());
38+
39+
/* *** PHP-Frameworks-Bench *** */
40+
require $_SERVER['DOCUMENT_ROOT'].'/PHP-Frameworks-Bench/libs/output_data.php';

cakephp-5.0/_benchmark/clean.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
rm -rf !("_benchmark")
3+
find -path './.*' -delete
4+
rm -rf _benchmark/temp
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# clear cache
3+
bin/cake cache clear_all
4+
echo -e "done"

0 commit comments

Comments
 (0)