Skip to content

Commit bcedbd7

Browse files
steevanbphpbenchmarks
authored and
phpbenchmarks
committed
Symfony 4.3.0 REST API benchmark
1 parent 7338daa commit bcedbd7

File tree

11 files changed

+1055
-530
lines changed

11 files changed

+1055
-530
lines changed

.phpbenchmarks/composer/composer.lock.php7.1

+311-156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.phpbenchmarks/composer/composer.lock.php7.2

+311-156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.phpbenchmarks/composer/composer.lock.php7.3

+311-156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
You will find lot of benchmarks for PHP frameworks and template engines on [phpbenchmarks.com](http://www.phpbenchmarks.com).
1010

11-
Benchmarks results are available for Apache Bench and Siege, and PHP 5.6 to 7.3.
11+
Benchmarks results are available from PHP 5.6 to latest version.
1212

1313
Our benchmarking protocol is available on [benchmarking protocol page](http://www.phpbenchmarks.com/en/documentation/benchmarking-protocol).
1414

bin/console

+26-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,39 @@
44
use App\Kernel;
55
use Symfony\Bundle\FrameworkBundle\Console\Application;
66
use Symfony\Component\Console\Input\ArgvInput;
7+
use Symfony\Component\Debug\Debug;
8+
9+
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
10+
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
11+
}
712

813
set_time_limit(0);
914

1015
require dirname(__DIR__).'/vendor/autoload.php';
1116

17+
if (!class_exists(Application::class)) {
18+
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
19+
}
20+
1221
$input = new ArgvInput();
22+
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
23+
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
24+
}
25+
26+
if ($input->hasParameterOption('--no-debug', true)) {
27+
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
28+
}
29+
30+
require dirname(__DIR__).'/config/bootstrap.php';
31+
32+
if ($_SERVER['APP_DEBUG']) {
33+
umask(0000);
1334

14-
require dirname(__DIR__).'/src/.bootstrap.php';
35+
if (class_exists(Debug::class)) {
36+
Debug::enable();
37+
}
38+
}
1539

16-
$kernel = new Kernel('prod', false);
40+
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
1741
$application = new Application($kernel);
1842
$application->run($input);

composer.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
"ext-ctype": "*",
88
"ext-iconv": "*",
99
"phpbenchmarks/symfony-common": "4.3.3",
10-
"symfony/console": "4.3.0-BETA2",
11-
"symfony/dotenv": "4.3.0-BETA2",
10+
"symfony/console": "4.3.0",
11+
"symfony/dotenv": "4.3.0",
1212
"symfony/flex": "^1.1",
13-
"symfony/framework-bundle": "4.3.0-BETA2",
13+
"symfony/framework-bundle": "4.3.0",
1414
"symfony/serializer-pack": "^1.0",
15-
"symfony/translation": "4.3.0-BETA2",
16-
"symfony/yaml": "4.3.0-BETA2"
15+
"symfony/translation": "4.3.0",
16+
"symfony/yaml": "4.3.0"
1717
},
18-
"minimum-stability": "beta",
1918
"config": {
2019
"preferred-install": {
2120
"*": "dist"
@@ -41,7 +40,7 @@
4140
"extra": {
4241
"symfony": {
4342
"allow-contrib": false,
44-
"require": "4.3.0-BETA2"
43+
"require": "4.3.0"
4544
}
4645
}
4746
}

config/bootstrap.php

+11-12
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22

33
use Symfony\Component\Dotenv\Dotenv;
44

5-
require dirname(__DIR__) . '/vendor/autoload.php';
5+
require dirname(__DIR__).'/vendor/autoload.php';
66

7-
$env = @include dirname(__DIR__) . '/.env.local.php';
8-
if (is_array($env)) {
9-
$_SERVER += $env;
7+
// Load cached env vars if the .env.local.php file exists
8+
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
9+
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
1010
$_ENV += $env;
11+
} elseif (!class_exists(Dotenv::class)) {
12+
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
1113
} else {
12-
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');
14+
// load all the .env files
15+
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
1316
}
1417

15-
$_SERVER['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
16-
$_ENV['APP_ENV'] = $_SERVER['APP_ENV'];
17-
18+
$_SERVER += $_ENV;
19+
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
1820
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
19-
$_SERVER['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN)
20-
? '1'
21-
: '0';
22-
$_ENV['APP_DEBUG'] = $_SERVER['APP_DEBUG'];
21+
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

src/.bootstrap.php

-22
This file was deleted.

src/Controller/.gitignore

Whitespace-only changes.

src/Kernel.php

+5-15
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,9 @@ class Kernel extends BaseKernel
1313
{
1414
use MicroKernelTrait;
1515

16-
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
16+
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
1717

18-
public function getCacheDir()
19-
{
20-
return $this->getProjectDir().'/var/cache/'.$this->environment;
21-
}
22-
23-
public function getLogDir()
24-
{
25-
return $this->getProjectDir().'/var/log';
26-
}
27-
28-
public function registerBundles()
18+
public function registerBundles(): iterable
2919
{
3020
$contents = require $this->getProjectDir().'/config/bundles.php';
3121
foreach ($contents as $class => $envs) {
@@ -40,7 +30,7 @@ public function getProjectDir(): string
4030
return \dirname(__DIR__);
4131
}
4232

43-
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
33+
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
4434
{
4535
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
4636
$container->setParameter('container.dumper.inline_class_loader', true);
@@ -52,12 +42,12 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
5242
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
5343
}
5444

55-
protected function configureRoutes(RouteCollectionBuilder $routes)
45+
protected function configureRoutes(RouteCollectionBuilder $routes): void
5646
{
5747
$confDir = $this->getProjectDir().'/config';
5848

59-
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
6049
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
50+
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
6151
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
6252
}
6353
}

symfony.lock

+73-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
{
2+
"doctrine/annotations": {
3+
"version": "1.0",
4+
"recipe": {
5+
"repo": "github.com/symfony/recipes",
6+
"branch": "master",
7+
"version": "1.0",
8+
"ref": "cb4152ebcadbe620ea2261da1a1c5a9b8cea7672"
9+
},
10+
"files": [
11+
"config/routes/annotations.yaml"
12+
]
13+
},
14+
"doctrine/lexer": {
15+
"version": "v1.0.1"
16+
},
17+
"phpbenchmarks/benchmark-rest-data": {
18+
"version": "1.1.0"
19+
},
220
"phpbenchmarks/symfony-common": {
321
"version": "4.1.0"
422
},
23+
"phpdocumentor/reflection-common": {
24+
"version": "1.0.1"
25+
},
26+
"phpdocumentor/reflection-docblock": {
27+
"version": "4.3.1"
28+
},
29+
"phpdocumentor/type-resolver": {
30+
"version": "0.4.0"
31+
},
532
"psr/cache": {
633
"version": "1.0.x-dev"
734
},
@@ -17,6 +44,9 @@
1744
"symfony/cache": {
1845
"version": "4.2-dev"
1946
},
47+
"symfony/cache-contracts": {
48+
"version": "v1.1.1"
49+
},
2050
"symfony/config": {
2151
"version": "4.2-dev"
2252
},
@@ -29,18 +59,21 @@
2959
"ref": ""
3060
}
3161
},
32-
"symfony/contracts": {
33-
"version": "1.0-dev"
34-
},
3562
"symfony/debug": {
3663
"version": "4.2-dev"
3764
},
3865
"symfony/dependency-injection": {
3966
"version": "4.2-dev"
4067
},
68+
"symfony/dotenv": {
69+
"version": "v4.3.0"
70+
},
4171
"symfony/event-dispatcher": {
4272
"version": "4.2-dev"
4373
},
74+
"symfony/event-dispatcher-contracts": {
75+
"version": "v1.1.1"
76+
},
4477
"symfony/filesystem": {
4578
"version": "4.2-dev"
4679
},
@@ -71,6 +104,9 @@
71104
"symfony/http-kernel": {
72105
"version": "4.2-dev"
73106
},
107+
"symfony/inflector": {
108+
"version": "v4.3.0"
109+
},
74110
"symfony/lts": {
75111
"version": "4-dev"
76112
},
@@ -89,6 +125,12 @@
89125
"symfony/polyfill-php73": {
90126
"version": "v1.11.0"
91127
},
128+
"symfony/property-access": {
129+
"version": "v4.3.0"
130+
},
131+
"symfony/property-info": {
132+
"version": "v4.3.0"
133+
},
92134
"symfony/routing": {
93135
"version": "4.2",
94136
"recipe": {
@@ -98,10 +140,38 @@
98140
"ref": ""
99141
}
100142
},
143+
"symfony/serializer": {
144+
"version": "v4.3.0"
145+
},
146+
"symfony/serializer-pack": {
147+
"version": "v1.0.2"
148+
},
149+
"symfony/service-contracts": {
150+
"version": "v1.1.2"
151+
},
152+
"symfony/translation": {
153+
"version": "3.3",
154+
"recipe": {
155+
"repo": "github.com/symfony/recipes",
156+
"branch": "master",
157+
"version": "3.3",
158+
"ref": "1fb02a6e1c8f3d4232cce485c9afa868d63b115a"
159+
},
160+
"files": [
161+
"config/packages/translation.yaml",
162+
"translations/.gitignore"
163+
]
164+
},
165+
"symfony/translation-contracts": {
166+
"version": "v1.1.2"
167+
},
101168
"symfony/var-exporter": {
102169
"version": "4.2-dev"
103170
},
104171
"symfony/yaml": {
105172
"version": "4.2-dev"
173+
},
174+
"webmozart/assert": {
175+
"version": "1.4.0"
106176
}
107177
}

0 commit comments

Comments
 (0)