浏览代码

Create REST API benchmark

symfony_4.2_rest-api
Steevan BARBOYON 7 年前
父节点
当前提交
4c25dc82f1

+ 0
- 12
.env 查看文件

@@ -1,12 +0,0 @@
1
-# This file defines all environment variables that the application needs.
2
-# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE.
3
-# Use ".env.local" for local overrides during development.
4
-# Use real environment variables when deploying to production.
5
-# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
6
-
7
-###> symfony/framework-bundle ###
8
-APP_ENV=dev
9
-APP_SECRET=ad33d4d8b44231f5233cd8dfd8f355bc
10
-#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
11
-#TRUSTED_HOSTS=localhost,example.com
12
-###< symfony/framework-bundle ###

+ 3
- 0
.gitignore 查看文件

@@ -1,4 +1,7 @@
1 1
 .idea/
2
+composer.lock
3
+!var/cache/.gitkeep
4
+!var/log/.gitkeep
2 5
 
3 6
 ###> symfony/framework-bundle ###
4 7
 /.env.local

+ 27
- 0
README.md 查看文件

@@ -0,0 +1,27 @@
1
+<p align="center">
2
+  <img src="http://www.phpbenchmarks.com/images/logo_github.png">
3
+  <br>
4
+  <a href="http://www.phpbenchmarks.com" target="_blank">www.phpbenchmarks.com</a>
5
+</p>
6
+
7
+## What is www.phpbenchmarks.com ?
8
+
9
+You will find lot of benchmarks for PHP frameworks and template engines.
10
+
11
+You can compare results between Apache Bench and Siege, and PHP 5.6 to 7.2.
12
+
13
+## What is this repository ?
14
+
15
+It's benchmark common code for Symfony benchmarks.
16
+
17
+Switch branch to select your Symfony major version and benchmark you want to see.
18
+
19
+See all Symfony benchmarked versions on [phpbenchmarks/symfony](https://github.com/phpbenchmarks/symfony).
20
+
21
+You can find how we benchmark on [phpbenchmarks.com](http://www.phpbenchmarks.com/en/benchmark-protocol.html).
22
+
23
+## Benchmarks
24
+
25
+You can find all Symfony benchmarks results on [phpbenchmarks.com](http://www.phpbenchmarks.com/en/benchmark/symfony.html).
26
+
27
+Scores are too low ? Do not hesitate to create a pull request, and ask a new benchmark !

+ 1
- 23
bin/console 查看文件

@@ -4,37 +4,15 @@
4 4
 use App\Kernel;
5 5
 use Symfony\Bundle\FrameworkBundle\Console\Application;
6 6
 use Symfony\Component\Console\Input\ArgvInput;
7
-use Symfony\Component\Debug\Debug;
8 7
 
9 8
 set_time_limit(0);
10 9
 
11 10
 require dirname(__DIR__).'/vendor/autoload.php';
12 11
 
13
-if (!class_exists(Application::class)) {
14
-    throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
15
-}
16
-
17 12
 $input = new ArgvInput();
18
-if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) {
19
-    putenv('APP_ENV='.$_ENV['APP_ENV']);
20
-    // force loading .env files when --env is defined
21
-    $_SERVER['APP_ENV'] = null;
22
-}
23
-
24
-if ($input->hasParameterOption('--no-debug', true)) {
25
-    putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
26
-}
27 13
 
28 14
 require dirname(__DIR__).'/src/.bootstrap.php';
29 15
 
30
-if ($_SERVER['APP_DEBUG']) {
31
-    umask(0000);
32
-
33
-    if (class_exists(Debug::class)) {
34
-        Debug::enable();
35
-    }
36
-}
37
-
38
-$kernel = new Kernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']);
16
+$kernel = new Kernel('prod', false);
39 17
 $application = new Application($kernel);
40 18
 $application->run($input);

+ 6
- 10
composer.json 查看文件

@@ -1,6 +1,7 @@
1 1
 {
2
-    "type": "project",
2
+    "name": "phpbenchmarks/symfony",
3 3
     "license": "proprietary",
4
+    "type": "project",
4 5
     "minimum-stability": "dev",
5 6
     "require": {
6 7
         "php": "^7.1.3",
@@ -9,10 +10,10 @@
9 10
         "symfony/console": "4.2.*",
10 11
         "symfony/flex": "^1.1",
11 12
         "symfony/framework-bundle": "4.2.*",
12
-        "symfony/yaml": "4.2.*"
13
-    },
14
-    "require-dev": {
15
-        "symfony/dotenv": "4.2.*"
13
+        "symfony/yaml": "4.2.*",
14
+        "symfony/translation": "4.2.*",
15
+        "symfony/serializer-pack": "^1.0",
16
+        "phpbenchmarks/symfony-common": "4.3.1"
16 17
     },
17 18
     "config": {
18 19
         "preferred-install": {
@@ -25,11 +26,6 @@
25 26
             "App\\": "src/"
26 27
         }
27 28
     },
28
-    "autoload-dev": {
29
-        "psr-4": {
30
-            "App\\Tests\\": "tests/"
31
-        }
32
-    },
33 29
     "replace": {
34 30
         "paragonie/random_compat": "2.*",
35 31
         "symfony/polyfill-ctype": "*",

composer.lock → composer.lock.php7.1 查看文件

@@ -4,8 +4,346 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "7a44a356fe1a341196ca1980b05b7bb7",
7
+    "content-hash": "a06f77aca0fd20a29f9d04aa738d3441",
8 8
     "packages": [
9
+        {
10
+            "name": "doctrine/annotations",
11
+            "version": "1.7.x-dev",
12
+            "source": {
13
+                "type": "git",
14
+                "url": "https://github.com/doctrine/annotations.git",
15
+                "reference": "232c5da3903f788e02328b4e8486eceea0c76e58"
16
+            },
17
+            "dist": {
18
+                "type": "zip",
19
+                "url": "https://api.github.com/repos/doctrine/annotations/zipball/232c5da3903f788e02328b4e8486eceea0c76e58",
20
+                "reference": "232c5da3903f788e02328b4e8486eceea0c76e58",
21
+                "shasum": ""
22
+            },
23
+            "require": {
24
+                "doctrine/lexer": "1.*",
25
+                "php": "^7.1"
26
+            },
27
+            "require-dev": {
28
+                "doctrine/cache": "1.*",
29
+                "phpunit/phpunit": "^7.0"
30
+            },
31
+            "type": "library",
32
+            "extra": {
33
+                "branch-alias": {
34
+                    "dev-master": "1.7.x-dev"
35
+                }
36
+            },
37
+            "autoload": {
38
+                "psr-4": {
39
+                    "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
40
+                }
41
+            },
42
+            "notification-url": "https://packagist.org/downloads/",
43
+            "license": [
44
+                "MIT"
45
+            ],
46
+            "authors": [
47
+                {
48
+                    "name": "Roman Borschel",
49
+                    "email": "roman@code-factory.org"
50
+                },
51
+                {
52
+                    "name": "Benjamin Eberlei",
53
+                    "email": "kontakt@beberlei.de"
54
+                },
55
+                {
56
+                    "name": "Guilherme Blanco",
57
+                    "email": "guilhermeblanco@gmail.com"
58
+                },
59
+                {
60
+                    "name": "Jonathan Wage",
61
+                    "email": "jonwage@gmail.com"
62
+                },
63
+                {
64
+                    "name": "Johannes Schmitt",
65
+                    "email": "schmittjoh@gmail.com"
66
+                }
67
+            ],
68
+            "description": "Docblock Annotations Parser",
69
+            "homepage": "http://www.doctrine-project.org",
70
+            "keywords": [
71
+                "annotations",
72
+                "docblock",
73
+                "parser"
74
+            ],
75
+            "time": "2018-05-06T10:14:50+00:00"
76
+        },
77
+        {
78
+            "name": "doctrine/lexer",
79
+            "version": "dev-master",
80
+            "source": {
81
+                "type": "git",
82
+                "url": "https://github.com/doctrine/lexer.git",
83
+                "reference": "4ab6ea7c838ccb340883fd78915af079949cc64d"
84
+            },
85
+            "dist": {
86
+                "type": "zip",
87
+                "url": "https://api.github.com/repos/doctrine/lexer/zipball/4ab6ea7c838ccb340883fd78915af079949cc64d",
88
+                "reference": "4ab6ea7c838ccb340883fd78915af079949cc64d",
89
+                "shasum": ""
90
+            },
91
+            "require": {
92
+                "php": ">=5.3.2"
93
+            },
94
+            "require-dev": {
95
+                "phpunit/phpunit": "^4.5"
96
+            },
97
+            "type": "library",
98
+            "extra": {
99
+                "branch-alias": {
100
+                    "dev-master": "1.0.x-dev"
101
+                }
102
+            },
103
+            "autoload": {
104
+                "psr-4": {
105
+                    "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
106
+                }
107
+            },
108
+            "notification-url": "https://packagist.org/downloads/",
109
+            "license": [
110
+                "MIT"
111
+            ],
112
+            "authors": [
113
+                {
114
+                    "name": "Roman Borschel",
115
+                    "email": "roman@code-factory.org"
116
+                },
117
+                {
118
+                    "name": "Guilherme Blanco",
119
+                    "email": "guilhermeblanco@gmail.com"
120
+                },
121
+                {
122
+                    "name": "Johannes Schmitt",
123
+                    "email": "schmittjoh@gmail.com"
124
+                }
125
+            ],
126
+            "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
127
+            "homepage": "https://www.doctrine-project.org/projects/lexer.html",
128
+            "keywords": [
129
+                "annotations",
130
+                "docblock",
131
+                "lexer",
132
+                "parser",
133
+                "php"
134
+            ],
135
+            "time": "2018-10-21T19:22:05+00:00"
136
+        },
137
+        {
138
+            "name": "phpbenchmarks/benchmark-rest-data",
139
+            "version": "1.0.0",
140
+            "source": {
141
+                "type": "git",
142
+                "url": "https://github.com/phpbenchmarks/benchmark-rest-data.git",
143
+                "reference": "f071a8ffcf9082f53ce1ee8b112aaacab2f32690"
144
+            },
145
+            "dist": {
146
+                "type": "zip",
147
+                "url": "https://api.github.com/repos/phpbenchmarks/benchmark-rest-data/zipball/f071a8ffcf9082f53ce1ee8b112aaacab2f32690",
148
+                "reference": "f071a8ffcf9082f53ce1ee8b112aaacab2f32690",
149
+                "shasum": ""
150
+            },
151
+            "require": {
152
+                "php": ">=5.4.0"
153
+            },
154
+            "type": "project",
155
+            "autoload": {
156
+                "psr-4": {
157
+                    "PhpBenchmarksRestData\\": ""
158
+                }
159
+            },
160
+            "notification-url": "https://packagist.org/downloads/",
161
+            "license": [
162
+                "proprietary"
163
+            ],
164
+            "time": "2017-10-24T01:42:51+00:00"
165
+        },
166
+        {
167
+            "name": "phpbenchmarks/symfony-common",
168
+            "version": "4.3.1",
169
+            "source": {
170
+                "type": "git",
171
+                "url": "https://github.com/phpbenchmarks/symfony-common.git",
172
+                "reference": "fe7b073c5003b17cfb65628bb531dc41fc55769c"
173
+            },
174
+            "dist": {
175
+                "type": "zip",
176
+                "url": "https://api.github.com/repos/phpbenchmarks/symfony-common/zipball/fe7b073c5003b17cfb65628bb531dc41fc55769c",
177
+                "reference": "fe7b073c5003b17cfb65628bb531dc41fc55769c",
178
+                "shasum": ""
179
+            },
180
+            "require": {
181
+                "phpbenchmarks/benchmark-rest-data": "1.0.0"
182
+            },
183
+            "type": "project",
184
+            "autoload": {
185
+                "psr-4": {
186
+                    "PhpBenchmarksSymfony\\RestApiBundle\\": ""
187
+                }
188
+            },
189
+            "notification-url": "https://packagist.org/downloads/",
190
+            "license": [
191
+                "proprietary"
192
+            ],
193
+            "time": "2018-11-15T14:08:30+00:00"
194
+        },
195
+        {
196
+            "name": "phpdocumentor/reflection-common",
197
+            "version": "1.0.1",
198
+            "source": {
199
+                "type": "git",
200
+                "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
201
+                "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
202
+            },
203
+            "dist": {
204
+                "type": "zip",
205
+                "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
206
+                "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
207
+                "shasum": ""
208
+            },
209
+            "require": {
210
+                "php": ">=5.5"
211
+            },
212
+            "require-dev": {
213
+                "phpunit/phpunit": "^4.6"
214
+            },
215
+            "type": "library",
216
+            "extra": {
217
+                "branch-alias": {
218
+                    "dev-master": "1.0.x-dev"
219
+                }
220
+            },
221
+            "autoload": {
222
+                "psr-4": {
223
+                    "phpDocumentor\\Reflection\\": [
224
+                        "src"
225
+                    ]
226
+                }
227
+            },
228
+            "notification-url": "https://packagist.org/downloads/",
229
+            "license": [
230
+                "MIT"
231
+            ],
232
+            "authors": [
233
+                {
234
+                    "name": "Jaap van Otterdijk",
235
+                    "email": "opensource@ijaap.nl"
236
+                }
237
+            ],
238
+            "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
239
+            "homepage": "http://www.phpdoc.org",
240
+            "keywords": [
241
+                "FQSEN",
242
+                "phpDocumentor",
243
+                "phpdoc",
244
+                "reflection",
245
+                "static analysis"
246
+            ],
247
+            "time": "2017-09-11T18:02:19+00:00"
248
+        },
249
+        {
250
+            "name": "phpdocumentor/reflection-docblock",
251
+            "version": "4.3.0",
252
+            "source": {
253
+                "type": "git",
254
+                "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
255
+                "reference": "94fd0001232e47129dd3504189fa1c7225010d08"
256
+            },
257
+            "dist": {
258
+                "type": "zip",
259
+                "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
260
+                "reference": "94fd0001232e47129dd3504189fa1c7225010d08",
261
+                "shasum": ""
262
+            },
263
+            "require": {
264
+                "php": "^7.0",
265
+                "phpdocumentor/reflection-common": "^1.0.0",
266
+                "phpdocumentor/type-resolver": "^0.4.0",
267
+                "webmozart/assert": "^1.0"
268
+            },
269
+            "require-dev": {
270
+                "doctrine/instantiator": "~1.0.5",
271
+                "mockery/mockery": "^1.0",
272
+                "phpunit/phpunit": "^6.4"
273
+            },
274
+            "type": "library",
275
+            "extra": {
276
+                "branch-alias": {
277
+                    "dev-master": "4.x-dev"
278
+                }
279
+            },
280
+            "autoload": {
281
+                "psr-4": {
282
+                    "phpDocumentor\\Reflection\\": [
283
+                        "src/"
284
+                    ]
285
+                }
286
+            },
287
+            "notification-url": "https://packagist.org/downloads/",
288
+            "license": [
289
+                "MIT"
290
+            ],
291
+            "authors": [
292
+                {
293
+                    "name": "Mike van Riel",
294
+                    "email": "me@mikevanriel.com"
295
+                }
296
+            ],
297
+            "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
298
+            "time": "2017-11-30T07:14:17+00:00"
299
+        },
300
+        {
301
+            "name": "phpdocumentor/type-resolver",
302
+            "version": "0.4.0",
303
+            "source": {
304
+                "type": "git",
305
+                "url": "https://github.com/phpDocumentor/TypeResolver.git",
306
+                "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
307
+            },
308
+            "dist": {
309
+                "type": "zip",
310
+                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
311
+                "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
312
+                "shasum": ""
313
+            },
314
+            "require": {
315
+                "php": "^5.5 || ^7.0",
316
+                "phpdocumentor/reflection-common": "^1.0"
317
+            },
318
+            "require-dev": {
319
+                "mockery/mockery": "^0.9.4",
320
+                "phpunit/phpunit": "^5.2||^4.8.24"
321
+            },
322
+            "type": "library",
323
+            "extra": {
324
+                "branch-alias": {
325
+                    "dev-master": "1.0.x-dev"
326
+                }
327
+            },
328
+            "autoload": {
329
+                "psr-4": {
330
+                    "phpDocumentor\\Reflection\\": [
331
+                        "src/"
332
+                    ]
333
+                }
334
+            },
335
+            "notification-url": "https://packagist.org/downloads/",
336
+            "license": [
337
+                "MIT"
338
+            ],
339
+            "authors": [
340
+                {
341
+                    "name": "Mike van Riel",
342
+                    "email": "me@mikevanriel.com"
343
+                }
344
+            ],
345
+            "time": "2017-07-14T14:27:02+00:00"
346
+        },
9 347
         {
10 348
             "name": "psr/cache",
11 349
             "version": "dev-master",
@@ -1074,6 +1412,64 @@
1074 1412
             "homepage": "https://symfony.com",
1075 1413
             "time": "2018-11-15T12:17:10+00:00"
1076 1414
         },
1415
+        {
1416
+            "name": "symfony/inflector",
1417
+            "version": "dev-master",
1418
+            "source": {
1419
+                "type": "git",
1420
+                "url": "https://github.com/symfony/inflector.git",
1421
+                "reference": "f9a637c0359f74404d44cf0da0a3ce53bae0787e"
1422
+            },
1423
+            "dist": {
1424
+                "type": "zip",
1425
+                "url": "https://api.github.com/repos/symfony/inflector/zipball/f9a637c0359f74404d44cf0da0a3ce53bae0787e",
1426
+                "reference": "f9a637c0359f74404d44cf0da0a3ce53bae0787e",
1427
+                "shasum": ""
1428
+            },
1429
+            "require": {
1430
+                "php": "^7.1.3",
1431
+                "symfony/polyfill-ctype": "~1.8"
1432
+            },
1433
+            "type": "library",
1434
+            "extra": {
1435
+                "branch-alias": {
1436
+                    "dev-master": "4.2-dev"
1437
+                }
1438
+            },
1439
+            "autoload": {
1440
+                "psr-4": {
1441
+                    "Symfony\\Component\\Inflector\\": ""
1442
+                },
1443
+                "exclude-from-classmap": [
1444
+                    "/Tests/"
1445
+                ]
1446
+            },
1447
+            "notification-url": "https://packagist.org/downloads/",
1448
+            "license": [
1449
+                "MIT"
1450
+            ],
1451
+            "authors": [
1452
+                {
1453
+                    "name": "Bernhard Schussek",
1454
+                    "email": "bschussek@gmail.com"
1455
+                },
1456
+                {
1457
+                    "name": "Symfony Community",
1458
+                    "homepage": "https://symfony.com/contributors"
1459
+                }
1460
+            ],
1461
+            "description": "Symfony Inflector Component",
1462
+            "homepage": "https://symfony.com",
1463
+            "keywords": [
1464
+                "inflection",
1465
+                "pluralize",
1466
+                "singularize",
1467
+                "string",
1468
+                "symfony",
1469
+                "words"
1470
+            ],
1471
+            "time": "2018-11-11T19:52:12+00:00"
1472
+        },
1077 1473
         {
1078 1474
             "name": "symfony/polyfill-mbstring",
1079 1475
             "version": "v1.10.0",
@@ -1133,6 +1529,149 @@
1133 1529
             ],
1134 1530
             "time": "2018-09-21T13:07:52+00:00"
1135 1531
         },
1532
+        {
1533
+            "name": "symfony/property-access",
1534
+            "version": "dev-master",
1535
+            "source": {
1536
+                "type": "git",
1537
+                "url": "https://github.com/symfony/property-access.git",
1538
+                "reference": "70e0559aa47014cfb317f45d4ad2856b84ae5ae1"
1539
+            },
1540
+            "dist": {
1541
+                "type": "zip",
1542
+                "url": "https://api.github.com/repos/symfony/property-access/zipball/70e0559aa47014cfb317f45d4ad2856b84ae5ae1",
1543
+                "reference": "70e0559aa47014cfb317f45d4ad2856b84ae5ae1",
1544
+                "shasum": ""
1545
+            },
1546
+            "require": {
1547
+                "php": "^7.1.3",
1548
+                "symfony/inflector": "~3.4|~4.0"
1549
+            },
1550
+            "require-dev": {
1551
+                "symfony/cache": "~3.4|~4.0"
1552
+            },
1553
+            "suggest": {
1554
+                "psr/cache-implementation": "To cache access methods."
1555
+            },
1556
+            "type": "library",
1557
+            "extra": {
1558
+                "branch-alias": {
1559
+                    "dev-master": "4.2-dev"
1560
+                }
1561
+            },
1562
+            "autoload": {
1563
+                "psr-4": {
1564
+                    "Symfony\\Component\\PropertyAccess\\": ""
1565
+                },
1566
+                "exclude-from-classmap": [
1567
+                    "/Tests/"
1568
+                ]
1569
+            },
1570
+            "notification-url": "https://packagist.org/downloads/",
1571
+            "license": [
1572
+                "MIT"
1573
+            ],
1574
+            "authors": [
1575
+                {
1576
+                    "name": "Fabien Potencier",
1577
+                    "email": "fabien@symfony.com"
1578
+                },
1579
+                {
1580
+                    "name": "Symfony Community",
1581
+                    "homepage": "https://symfony.com/contributors"
1582
+                }
1583
+            ],
1584
+            "description": "Symfony PropertyAccess Component",
1585
+            "homepage": "https://symfony.com",
1586
+            "keywords": [
1587
+                "access",
1588
+                "array",
1589
+                "extraction",
1590
+                "index",
1591
+                "injection",
1592
+                "object",
1593
+                "property",
1594
+                "property path",
1595
+                "reflection"
1596
+            ],
1597
+            "time": "2018-11-15T12:17:10+00:00"
1598
+        },
1599
+        {
1600
+            "name": "symfony/property-info",
1601
+            "version": "dev-master",
1602
+            "source": {
1603
+                "type": "git",
1604
+                "url": "https://github.com/symfony/property-info.git",
1605
+                "reference": "d34c76cfe2d16c594e26d0d11fabfef77b3651e5"
1606
+            },
1607
+            "dist": {
1608
+                "type": "zip",
1609
+                "url": "https://api.github.com/repos/symfony/property-info/zipball/d34c76cfe2d16c594e26d0d11fabfef77b3651e5",
1610
+                "reference": "d34c76cfe2d16c594e26d0d11fabfef77b3651e5",
1611
+                "shasum": ""
1612
+            },
1613
+            "require": {
1614
+                "php": "^7.1.3",
1615
+                "symfony/inflector": "~3.4|~4.0"
1616
+            },
1617
+            "conflict": {
1618
+                "phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
1619
+                "phpdocumentor/type-resolver": "<0.3.0",
1620
+                "symfony/dependency-injection": "<3.4"
1621
+            },
1622
+            "require-dev": {
1623
+                "doctrine/annotations": "~1.0",
1624
+                "phpdocumentor/reflection-docblock": "^3.0|^4.0",
1625
+                "symfony/cache": "~3.4|~4.0",
1626
+                "symfony/dependency-injection": "~3.4|~4.0",
1627
+                "symfony/serializer": "~3.4|~4.0"
1628
+            },
1629
+            "suggest": {
1630
+                "phpdocumentor/reflection-docblock": "To use the PHPDoc",
1631
+                "psr/cache-implementation": "To cache results",
1632
+                "symfony/doctrine-bridge": "To use Doctrine metadata",
1633
+                "symfony/serializer": "To use Serializer metadata"
1634
+            },
1635
+            "type": "library",
1636
+            "extra": {
1637
+                "branch-alias": {
1638
+                    "dev-master": "4.2-dev"
1639
+                }
1640
+            },
1641
+            "autoload": {
1642
+                "psr-4": {
1643
+                    "Symfony\\Component\\PropertyInfo\\": ""
1644
+                },
1645
+                "exclude-from-classmap": [
1646
+                    "/Tests/"
1647
+                ]
1648
+            },
1649
+            "notification-url": "https://packagist.org/downloads/",
1650
+            "license": [
1651
+                "MIT"
1652
+            ],
1653
+            "authors": [
1654
+                {
1655
+                    "name": "Kévin Dunglas",
1656
+                    "email": "dunglas@gmail.com"
1657
+                },
1658
+                {
1659
+                    "name": "Symfony Community",
1660
+                    "homepage": "https://symfony.com/contributors"
1661
+                }
1662
+            ],
1663
+            "description": "Symfony Property Info Component",
1664
+            "homepage": "https://symfony.com",
1665
+            "keywords": [
1666
+                "doctrine",
1667
+                "phpdoc",
1668
+                "property",
1669
+                "symfony",
1670
+                "type",
1671
+                "validator"
1672
+            ],
1673
+            "time": "2018-11-11T19:52:12+00:00"
1674
+        },
1136 1675
         {
1137 1676
             "name": "symfony/routing",
1138 1677
             "version": "dev-master",
@@ -1210,6 +1749,190 @@
1210 1749
             ],
1211 1750
             "time": "2018-11-15T12:17:10+00:00"
1212 1751
         },
1752
+        {
1753
+            "name": "symfony/serializer",
1754
+            "version": "dev-master",
1755
+            "source": {
1756
+                "type": "git",
1757
+                "url": "https://github.com/symfony/serializer.git",
1758
+                "reference": "830a3add86777766b4fc6490e3f5e72d693704c2"
1759
+            },
1760
+            "dist": {
1761
+                "type": "zip",
1762
+                "url": "https://api.github.com/repos/symfony/serializer/zipball/830a3add86777766b4fc6490e3f5e72d693704c2",
1763
+                "reference": "830a3add86777766b4fc6490e3f5e72d693704c2",
1764
+                "shasum": ""
1765
+            },
1766
+            "require": {
1767
+                "php": "^7.1.3",
1768
+                "symfony/polyfill-ctype": "~1.8"
1769
+            },
1770
+            "conflict": {
1771
+                "phpdocumentor/type-resolver": "<0.2.1",
1772
+                "symfony/dependency-injection": "<3.4",
1773
+                "symfony/property-access": "<3.4",
1774
+                "symfony/property-info": "<3.4",
1775
+                "symfony/yaml": "<3.4"
1776
+            },
1777
+            "require-dev": {
1778
+                "doctrine/annotations": "~1.0",
1779
+                "doctrine/cache": "~1.0",
1780
+                "phpdocumentor/reflection-docblock": "^3.0|^4.0",
1781
+                "symfony/cache": "~3.4|~4.0",
1782
+                "symfony/config": "~3.4|~4.0",
1783
+                "symfony/dependency-injection": "~3.4|~4.0",
1784
+                "symfony/http-foundation": "~3.4|~4.0",
1785
+                "symfony/property-access": "~3.4|~4.0",
1786
+                "symfony/property-info": "~3.4|~4.0",
1787
+                "symfony/validator": "~3.4|~4.0",
1788
+                "symfony/yaml": "~3.4|~4.0"
1789
+            },
1790
+            "suggest": {
1791
+                "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
1792
+                "doctrine/cache": "For using the default cached annotation reader and metadata cache.",
1793
+                "psr/cache-implementation": "For using the metadata cache.",
1794
+                "symfony/config": "For using the XML mapping loader.",
1795
+                "symfony/http-foundation": "To use the DataUriNormalizer.",
1796
+                "symfony/property-access": "For using the ObjectNormalizer.",
1797
+                "symfony/property-info": "To deserialize relations.",
1798
+                "symfony/yaml": "For using the default YAML mapping loader."
1799
+            },
1800
+            "type": "library",
1801
+            "extra": {
1802
+                "branch-alias": {
1803
+                    "dev-master": "4.2-dev"
1804
+                }
1805
+            },
1806
+            "autoload": {
1807
+                "psr-4": {
1808
+                    "Symfony\\Component\\Serializer\\": ""
1809
+                },
1810
+                "exclude-from-classmap": [
1811
+                    "/Tests/"
1812
+                ]
1813
+            },
1814
+            "notification-url": "https://packagist.org/downloads/",
1815
+            "license": [
1816
+                "MIT"
1817
+            ],
1818
+            "authors": [
1819
+                {
1820
+                    "name": "Fabien Potencier",
1821
+                    "email": "fabien@symfony.com"
1822
+                },
1823
+                {
1824
+                    "name": "Symfony Community",
1825
+                    "homepage": "https://symfony.com/contributors"
1826
+                }
1827
+            ],
1828
+            "description": "Symfony Serializer Component",
1829
+            "homepage": "https://symfony.com",
1830
+            "time": "2018-11-11T19:52:12+00:00"
1831
+        },
1832
+        {
1833
+            "name": "symfony/serializer-pack",
1834
+            "version": "v1.0.1",
1835
+            "source": {
1836
+                "type": "git",
1837
+                "url": "https://github.com/symfony/serializer-pack.git",
1838
+                "reference": "35cea385ea44d1f40ec12571996bf768fbe409de"
1839
+            },
1840
+            "dist": {
1841
+                "type": "zip",
1842
+                "url": "https://api.github.com/repos/symfony/serializer-pack/zipball/35cea385ea44d1f40ec12571996bf768fbe409de",
1843
+                "reference": "35cea385ea44d1f40ec12571996bf768fbe409de",
1844
+                "shasum": ""
1845
+            },
1846
+            "require": {
1847
+                "doctrine/annotations": "^1.0",
1848
+                "php": "^7.0",
1849
+                "phpdocumentor/reflection-docblock": "^3.0|^4.0",
1850
+                "symfony/cache": "^3.3|^4.0",
1851
+                "symfony/property-access": "^3.3|^4.0",
1852
+                "symfony/property-info": "^3.3|^4.0",
1853
+                "symfony/serializer": "^3.3|^4.0"
1854
+            },
1855
+            "type": "symfony-pack",
1856
+            "notification-url": "https://packagist.org/downloads/",
1857
+            "license": [
1858
+                "MIT"
1859
+            ],
1860
+            "description": "A pack for the Symfony serializer",
1861
+            "time": "2017-12-12T01:48:53+00:00"
1862
+        },
1863
+        {
1864
+            "name": "symfony/translation",
1865
+            "version": "dev-master",
1866
+            "source": {
1867
+                "type": "git",
1868
+                "url": "https://github.com/symfony/translation.git",
1869
+                "reference": "f393c2ed9e42907ea7ccd4d8f2c55b5eb30bd0c2"
1870
+            },
1871
+            "dist": {
1872
+                "type": "zip",
1873
+                "url": "https://api.github.com/repos/symfony/translation/zipball/f393c2ed9e42907ea7ccd4d8f2c55b5eb30bd0c2",
1874
+                "reference": "f393c2ed9e42907ea7ccd4d8f2c55b5eb30bd0c2",
1875
+                "shasum": ""
1876
+            },
1877
+            "require": {
1878
+                "php": "^7.1.3",
1879
+                "symfony/contracts": "^1.0",
1880
+                "symfony/polyfill-mbstring": "~1.0"
1881
+            },
1882
+            "conflict": {
1883
+                "symfony/config": "<3.4",
1884
+                "symfony/dependency-injection": "<3.4",
1885
+                "symfony/yaml": "<3.4"
1886
+            },
1887
+            "provide": {
1888
+                "symfony/translation-contracts-implementation": "1.0"
1889
+            },
1890
+            "require-dev": {
1891
+                "psr/log": "~1.0",
1892
+                "symfony/config": "~3.4|~4.0",
1893
+                "symfony/console": "~3.4|~4.0",
1894
+                "symfony/dependency-injection": "~3.4|~4.0",
1895
+                "symfony/finder": "~2.8|~3.0|~4.0",
1896
+                "symfony/intl": "~3.4|~4.0",
1897
+                "symfony/yaml": "~3.4|~4.0"
1898
+            },
1899
+            "suggest": {
1900
+                "psr/log-implementation": "To use logging capability in translator",
1901
+                "symfony/config": "",
1902
+                "symfony/yaml": ""
1903
+            },
1904
+            "type": "library",
1905
+            "extra": {
1906
+                "branch-alias": {
1907
+                    "dev-master": "4.2-dev"
1908
+                }
1909
+            },
1910
+            "autoload": {
1911
+                "psr-4": {
1912
+                    "Symfony\\Component\\Translation\\": ""
1913
+                },
1914
+                "exclude-from-classmap": [
1915
+                    "/Tests/"
1916
+                ]
1917
+            },
1918
+            "notification-url": "https://packagist.org/downloads/",
1919
+            "license": [
1920
+                "MIT"
1921
+            ],
1922
+            "authors": [
1923
+                {
1924
+                    "name": "Fabien Potencier",
1925
+                    "email": "fabien@symfony.com"
1926
+                },
1927
+                {
1928
+                    "name": "Symfony Community",
1929
+                    "homepage": "https://symfony.com/contributors"
1930
+                }
1931
+            ],
1932
+            "description": "Symfony Translation Component",
1933
+            "homepage": "https://symfony.com",
1934
+            "time": "2018-11-14T16:25:09+00:00"
1935
+        },
1213 1936
         {
1214 1937
             "name": "symfony/var-exporter",
1215 1938
             "version": "dev-master",
@@ -1328,42 +2051,38 @@
1328 2051
             "description": "Symfony Yaml Component",
1329 2052
             "homepage": "https://symfony.com",
1330 2053
             "time": "2018-11-11T19:52:12+00:00"
1331
-        }
1332
-    ],
1333
-    "packages-dev": [
2054
+        },
1334 2055
         {
1335
-            "name": "symfony/dotenv",
2056
+            "name": "webmozart/assert",
1336 2057
             "version": "dev-master",
1337 2058
             "source": {
1338 2059
                 "type": "git",
1339
-                "url": "https://github.com/symfony/dotenv.git",
1340
-                "reference": "64b5cde8384fd4e9ab98ce23613e2a6d56044796"
2060
+                "url": "https://github.com/webmozart/assert.git",
2061
+                "reference": "53927dddf3afa2088b355188e143bba42159bf5d"
1341 2062
             },
1342 2063
             "dist": {
1343 2064
                 "type": "zip",
1344
-                "url": "https://api.github.com/repos/symfony/dotenv/zipball/64b5cde8384fd4e9ab98ce23613e2a6d56044796",
1345
-                "reference": "64b5cde8384fd4e9ab98ce23613e2a6d56044796",
2065
+                "url": "https://api.github.com/repos/webmozart/assert/zipball/53927dddf3afa2088b355188e143bba42159bf5d",
2066
+                "reference": "53927dddf3afa2088b355188e143bba42159bf5d",
1346 2067
                 "shasum": ""
1347 2068
             },
1348 2069
             "require": {
1349
-                "php": "^7.1.3"
2070
+                "php": "^5.3.3 || ^7.0"
1350 2071
             },
1351 2072
             "require-dev": {
1352
-                "symfony/process": "~3.4|~4.0"
2073
+                "phpunit/phpunit": "^4.6",
2074
+                "sebastian/version": "^1.0.1"
1353 2075
             },
1354 2076
             "type": "library",
1355 2077
             "extra": {
1356 2078
                 "branch-alias": {
1357
-                    "dev-master": "4.2-dev"
2079
+                    "dev-master": "1.3-dev"
1358 2080
                 }
1359 2081
             },
1360 2082
             "autoload": {
1361 2083
                 "psr-4": {
1362
-                    "Symfony\\Component\\Dotenv\\": ""
1363
-                },
1364
-                "exclude-from-classmap": [
1365
-                    "/Tests/"
1366
-                ]
2084
+                    "Webmozart\\Assert\\": "src/"
2085
+                }
1367 2086
             },
1368 2087
             "notification-url": "https://packagist.org/downloads/",
1369 2088
             "license": [
@@ -1371,24 +2090,20 @@
1371 2090
             ],
1372 2091
             "authors": [
1373 2092
                 {
1374
-                    "name": "Fabien Potencier",
1375
-                    "email": "fabien@symfony.com"
1376
-                },
1377
-                {
1378
-                    "name": "Symfony Community",
1379
-                    "homepage": "https://symfony.com/contributors"
2093
+                    "name": "Bernhard Schussek",
2094
+                    "email": "bschussek@gmail.com"
1380 2095
                 }
1381 2096
             ],
1382
-            "description": "Registers environment variables from a .env file",
1383
-            "homepage": "https://symfony.com",
2097
+            "description": "Assertions to validate method input/output with nice error messages.",
1384 2098
             "keywords": [
1385
-                "dotenv",
1386
-                "env",
1387
-                "environment"
2099
+                "assert",
2100
+                "check",
2101
+                "validate"
1388 2102
             ],
1389
-            "time": "2018-11-13T19:27:38+00:00"
2103
+            "time": "2018-05-29T14:25:02+00:00"
1390 2104
         }
1391 2105
     ],
2106
+    "packages-dev": [],
1392 2107
     "aliases": [],
1393 2108
     "minimum-stability": "dev",
1394 2109
     "stability-flags": [],

+ 2118
- 0
composer.lock.php7.2
文件差异内容过多而无法显示
查看文件


+ 1
- 0
config/bundles.php 查看文件

@@ -2,4 +2,5 @@
2 2
 
3 3
 return [
4 4
     Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
5
+    PhpBenchmarksSymfony\RestApiBundle\RestApiBundle::class => ['all' => true]
5 6
 ];

+ 0
- 3
config/packages/dev/routing.yaml 查看文件

@@ -1,3 +0,0 @@
1
-framework:
2
-    router:
3
-        strict_requirements: true

+ 0
- 4
config/packages/test/framework.yaml 查看文件

@@ -1,4 +0,0 @@
1
-framework:
2
-    test: true
3
-    session:
4
-        storage_id: session.storage.mock_file

+ 0
- 3
config/packages/test/routing.yaml 查看文件

@@ -1,3 +0,0 @@
1
-framework:
2
-    router:
3
-        strict_requirements: true

+ 6
- 0
config/packages/translation.yaml 查看文件

@@ -0,0 +1,6 @@
1
+framework:
2
+    default_locale: '%locale%'
3
+    translator:
4
+        default_path: '%kernel.project_dir%/translations'
5
+        fallbacks:
6
+            - '%locale%'

+ 2
- 3
config/routes.yaml 查看文件

@@ -1,3 +1,2 @@
1
-#index:
2
-#    path: /
3
-#    controller: App\Controller\DefaultController::index
1
+rest:
2
+    resource: ../vendor/phpbenchmarks/symfony-common/Resources/config/routing.yml

+ 2
- 25
config/services.yaml 查看文件

@@ -1,27 +1,4 @@
1
-# This file is the entry point to configure your own services.
2
-# Files in the packages/ subdirectory configure your dependencies.
1
+# useless for us, but needed by Symfony Flex
3 2
 
4
-# Put parameters here that don't need to change on each machine where the app is deployed
5
-# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
6 3
 parameters:
7
-
8
-services:
9
-    # default configuration for services in *this* file
10
-    _defaults:
11
-        autowire: true      # Automatically injects dependencies in your services.
12
-        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
13
-
14
-    # makes classes in src/ available to be used as services
15
-    # this creates a service per class whose id is the fully-qualified class name
16
-    App\:
17
-        resource: '../src/*'
18
-        exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
19
-
20
-    # controllers are imported separately to make sure services can be injected
21
-    # as action arguments even if you don't extend any base controller class
22
-    App\Controller\:
23
-        resource: '../src/Controller'
24
-        tags: ['controller.service_arguments']
25
-
26
-    # add more service definitions when explicit configuration is needed
27
-    # please note that last definitions always *replace* previous ones
4
+    locale: 'en'

+ 26
- 0
init_benchmark.sh 查看文件

@@ -0,0 +1,26 @@
1
+#!/usr/bin/env bash
2
+
3
+function clearCacheAndLogs() {
4
+    sudo /bin/rm -rf var/cache/*
5
+    [ "$?" != "0" ] && exit 1
6
+    sudo /bin/chmod -R 777 var/cache
7
+    [ "$?" != "0" ] && exit 1
8
+
9
+    sudo /bin/rm -rf var/log/*
10
+    [ "$?" != "0" ] && exit 1
11
+    sudo /bin/chmod -R 777 var/log
12
+    [ "$?" != "0" ] && exit 1
13
+
14
+    php bin/console cache:warmup
15
+}
16
+
17
+function init() {
18
+    clearCacheAndLogs
19
+
20
+    composer install --no-dev --classmap-authoritative
21
+    [ "$?" != "0" ] && exit 1
22
+
23
+    clearCacheAndLogs
24
+
25
+    return 0
26
+}

+ 3
- 8
public/index.php 查看文件

@@ -1,17 +1,10 @@
1 1
 <?php
2 2
 
3 3
 use App\Kernel;
4
-use Symfony\Component\Debug\Debug;
5 4
 use Symfony\Component\HttpFoundation\Request;
6 5
 
7 6
 require dirname(__DIR__).'/src/.bootstrap.php';
8 7
 
9
-if ($_SERVER['APP_DEBUG']) {
10
-    umask(0000);
11
-
12
-    Debug::enable();
13
-}
14
-
15 8
 if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
16 9
     Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
17 10
 }
@@ -20,8 +13,10 @@ if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false
20 13
     Request::setTrustedHosts(explode(',', $trustedHosts));
21 14
 }
22 15
 
23
-$kernel = new Kernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']);
16
+$kernel = new Kernel('prod', false);
24 17
 $request = Request::createFromGlobals();
25 18
 $response = $kernel->handle($request);
26 19
 $response->send();
27 20
 $kernel->terminate($request, $response);
21
+
22
+// require phpbenchmarks stats.php here when needed

+ 2
- 17
src/.bootstrap.php 查看文件

@@ -1,21 +1,6 @@
1 1
 <?php
2 2
 
3
-use Symfony\Component\Dotenv\Dotenv;
4
-
5 3
 require dirname(__DIR__).'/vendor/autoload.php';
6 4
 
7
-if (!array_key_exists('APP_ENV', $_SERVER)) {
8
-    $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] ?? null;
9
-}
10
-
11
-if ('prod' !== $_SERVER['APP_ENV']) {
12
-    if (!class_exists(Dotenv::class)) {
13
-        throw new RuntimeException('The "APP_ENV" environment variable is not set to "prod". Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
14
-    }
15
-
16
-    (new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
17
-}
18
-
19
-$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $_SERVER['APP_ENV'] ?: $_ENV['APP_ENV'] ?: 'dev';
20
-$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
21
-$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
5
+$_SERVER['APP_ENV'] = 'prod';
6
+$_SERVER['APP_DEBUG'] = false;

+ 57
- 0
symfony.lock 查看文件

@@ -1,4 +1,31 @@
1 1
 {
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
+    },
11
+    "doctrine/lexer": {
12
+        "version": "1.0.x-dev"
13
+    },
14
+    "phpbenchmarks/benchmark-rest-data": {
15
+        "version": "1.0.0"
16
+    },
17
+    "phpbenchmarks/symfony-common": {
18
+        "version": "4.3.0"
19
+    },
20
+    "phpdocumentor/reflection-common": {
21
+        "version": "1.0.1"
22
+    },
23
+    "phpdocumentor/reflection-docblock": {
24
+        "version": "4.3.0"
25
+    },
26
+    "phpdocumentor/type-resolver": {
27
+        "version": "0.4.0"
28
+    },
2 29
     "psr/cache": {
3 30
         "version": "1.0.x-dev"
4 31
     },
@@ -71,9 +98,21 @@
71 98
     "symfony/http-kernel": {
72 99
         "version": "4.2-dev"
73 100
     },
101
+    "symfony/inflector": {
102
+        "version": "4.2-dev"
103
+    },
104
+    "symfony/lts": {
105
+        "version": "4-dev"
106
+    },
74 107
     "symfony/polyfill-mbstring": {
75 108
         "version": "v1.10.0"
76 109
     },
110
+    "symfony/property-access": {
111
+        "version": "4.2-dev"
112
+    },
113
+    "symfony/property-info": {
114
+        "version": "4.2-dev"
115
+    },
77 116
     "symfony/routing": {
78 117
         "version": "4.2",
79 118
         "recipe": {
@@ -83,10 +122,28 @@
83 122
             "ref": ""
84 123
         }
85 124
     },
125
+    "symfony/serializer": {
126
+        "version": "4.2-dev"
127
+    },
128
+    "symfony/serializer-pack": {
129
+        "version": "v1.0.1"
130
+    },
131
+    "symfony/translation": {
132
+        "version": "3.3",
133
+        "recipe": {
134
+            "repo": "github.com/symfony/recipes",
135
+            "branch": "master",
136
+            "version": "3.3",
137
+            "ref": "1fb02a6e1c8f3d4232cce485c9afa868d63b115a"
138
+        }
139
+    },
86 140
     "symfony/var-exporter": {
87 141
         "version": "4.2-dev"
88 142
     },
89 143
     "symfony/yaml": {
90 144
         "version": "4.2-dev"
145
+    },
146
+    "webmozart/assert": {
147
+        "version": "1.3-dev"
91 148
     }
92 149
 }

src/Controller/.gitignore → translations/.gitignore 查看文件


+ 0
- 0
var/cache/.gitkeep 查看文件


+ 0
- 0
var/log/.gitkeep 查看文件


正在加载...
取消
保存