浏览代码

Create restapi branch

tags/2.3.0
Steevan BARBOYON 8 年前
父节点
当前提交
ac9bb132e9

+ 1
- 0
.gitignore 查看文件

1
 .idea/
1
 .idea/
2
+vendor/

+ 0
- 15
Bundle/HelloWorldBundle/Controller/HelloWorldController.php 查看文件

1
-<?php
2
-
3
-namespace PhpBenchmarksSymfony\Bundle\HelloWorldBundle\Controller;
4
-
5
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
-use Symfony\Component\HttpFoundation\Response;
7
-
8
-class HelloWorldController extends Controller
9
-{
10
-    /** @return Response */
11
-    public function helloworldAction()
12
-    {
13
-        return new Response('Hello World !');
14
-    }
15
-}

+ 0
- 10
Bundle/HelloWorldBundle/HelloWorldBundle.php 查看文件

1
-<?php
2
-
3
-namespace PhpBenchmarksSymfony\Bundle\HelloWorldBundle;
4
-
5
-use Symfony\Component\HttpKernel\Bundle\Bundle;
6
-
7
-class HelloWorldBundle extends Bundle
8
-{
9
-
10
-}

+ 0
- 3
Bundle/HelloWorldBundle/Resources/config/routing.yml 查看文件

1
-helloworld:
2
-    path: /benchmark/helloworld
3
-    defaults: { _controller: HelloWorldBundle:HelloWorld:helloworld }

+ 0
- 1500
Bundle/RestBundle/Resources/config/routing.yml
文件差异内容过多而无法显示
查看文件


+ 0
- 17
Bundle/RestBundle/RestBundle.php 查看文件

1
-<?php
2
-
3
-namespace PhpBenchmarksSymfony\Bundle\RestBundle;
4
-
5
-use PhpBenchmarksSymfony\DependencyInjection\CompilerPass\AddTranslationsPass;
6
-use Symfony\Component\DependencyInjection\ContainerBuilder;
7
-use Symfony\Component\HttpKernel\Bundle\Bundle;
8
-
9
-class RestBundle extends Bundle
10
-{
11
-    public function build(ContainerBuilder $container)
12
-    {
13
-        parent::build($container);
14
-
15
-        $container->addCompilerPass(new AddTranslationsPass());
16
-    }
17
-}

Bundle/RestBundle/Controller/RestController.php → Controller/RestApiController.php 查看文件

1
 <?php
1
 <?php
2
 
2
 
3
-namespace PhpBenchmarksSymfony\Bundle\RestBundle\Controller;
3
+namespace PhpBenchmarksSymfony\RestApiBundle\Controller;
4
 
4
 
5
 use PhpBenchmarksRestData\Service;
5
 use PhpBenchmarksRestData\Service;
6
-use PhpBenchmarksSymfony\EventListener\DefineLocaleEventListener;
6
+use PhpBenchmarksSymfony\RestApiBundle\EventListener\DefineLocaleEventListener;
7
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
 use Symfony\Component\HttpFoundation\JsonResponse;
8
 use Symfony\Component\HttpFoundation\JsonResponse;
9
 use Symfony\Component\HttpFoundation\Response;
9
 use Symfony\Component\HttpFoundation\Response;
10
 
10
 
11
-class RestController extends Controller
11
+class RestApiController extends Controller
12
 {
12
 {
13
     /** @return Response */
13
     /** @return Response */
14
     public function restAction()
14
     public function restAction()

+ 0
- 26
DependencyInjection/CompilerPass/AddTranslationsPass.php 查看文件

1
-<?php
2
-
3
-namespace PhpBenchmarksSymfony\DependencyInjection\CompilerPass;
4
-
5
-use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
-use Symfony\Component\DependencyInjection\ContainerBuilder;
7
-
8
-class AddTranslationsPass implements CompilerPassInterface
9
-{
10
-    public function process(ContainerBuilder $container)
11
-    {
12
-        $definition = $container->findDefinition('translator');
13
-        $definition->addMethodCall(
14
-            'addResource',
15
-            ['yml', __DIR__ . '/../../Translation/phpbenchmarks.en.yml', 'en', 'phpbenchmarks']
16
-        );
17
-        $definition->addMethodCall(
18
-            'addResource',
19
-            ['yml', __DIR__ . '/../../Translation/phpbenchmarks.en_GB.yml', 'en_GB', 'phpbenchmarks']
20
-        );
21
-        $definition->addMethodCall(
22
-            'addResource',
23
-            ['yml', __DIR__ . '/../../Translation/phpbenchmarks.fr_FR.yml', 'fr_FR', 'phpbenchmarks']
24
-        );
25
-    }
26
-}

Bundle/RestBundle/DependencyInjection/RestExtension.php → DependencyInjection/RestApiExtension.php 查看文件

1
 <?php
1
 <?php
2
 
2
 
3
-namespace PhpBenchmarksSymfony\Bundle\RestBundle\DependencyInjection;
3
+namespace PhpBenchmarksSymfony\RestApiBundle\DependencyInjection;
4
 
4
 
5
 use Symfony\Component\Config\FileLocator;
5
 use Symfony\Component\Config\FileLocator;
6
 use Symfony\Component\DependencyInjection\ContainerBuilder;
6
 use Symfony\Component\DependencyInjection\ContainerBuilder;
7
 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
7
 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
8
 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8
 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
 
9
 
10
-class RestExtension extends Extension
10
+class RestApiExtension extends Extension
11
 {
11
 {
12
     /**
12
     /**
13
      * @param array $configs
13
      * @param array $configs

+ 1
- 1
EventListener/DefineLocaleEventListener.php 查看文件

1
 <?php
1
 <?php
2
 
2
 
3
-namespace PhpBenchmarksSymfony\EventListener;
3
+namespace PhpBenchmarksSymfony\RestApiBundle\EventListener;
4
 
4
 
5
 use Symfony\Component\HttpFoundation\RequestStack;
5
 use Symfony\Component\HttpFoundation\RequestStack;
6
 use Symfony\Component\Translation\TranslatorInterface;
6
 use Symfony\Component\Translation\TranslatorInterface;

Bundle/RestBundle/Normalizer/CommentNormalizer.php → Normalizer/CommentNormalizer.php 查看文件

1
 <?php
1
 <?php
2
 
2
 
3
-namespace PhpBenchmarksSymfony\Bundle\RestBundle\Normalizer;
3
+namespace PhpBenchmarksSymfony\RestApiBundle\Normalizer;
4
 
4
 
5
 use PhpBenchmarksRestData\Comment;
5
 use PhpBenchmarksRestData\Comment;
6
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
6
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

Bundle/RestBundle/Normalizer/CommentTypeNormalizer.php → Normalizer/CommentTypeNormalizer.php 查看文件

1
 <?php
1
 <?php
2
 
2
 
3
-namespace PhpBenchmarksSymfony\Bundle\RestBundle\Normalizer;
3
+namespace PhpBenchmarksSymfony\RestApiBundle\Normalizer;
4
 
4
 
5
 use PhpBenchmarksRestData\CommentType;
5
 use PhpBenchmarksRestData\CommentType;
6
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
6
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

Bundle/RestBundle/Normalizer/UserNormalizer.php → Normalizer/UserNormalizer.php 查看文件

1
 <?php
1
 <?php
2
 
2
 
3
-namespace PhpBenchmarksSymfony\Bundle\RestBundle\Normalizer;
3
+namespace PhpBenchmarksSymfony\RestApiBundle\Normalizer;
4
 
4
 
5
 use PhpBenchmarksRestData\User;
5
 use PhpBenchmarksRestData\User;
6
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
6
 use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

+ 28
- 4
README.md 查看文件

14
 
14
 
15
 It's benchmark bundles for almost all Symfony versions.
15
 It's benchmark bundles for almost all Symfony versions.
16
 
16
 
17
-Symfony 2.0 to 2.3 : use [2.0 version](https://github.com/phpbenchmarks/symfony/tree/2.0).
17
+As Symfony change `request` service to `request_stack` in Symfony 2.4, branches has been created for Symfony <= 2.3.
18
 
18
 
19
-Symfony 2.4 to latest : use [1.0 version](https://github.com/phpbenchmarks/symfony).
19
+Hello World: [helloworld](https://github.com/phpbenchmarks/symfony/tree/helloworld)
20
+
21
+REST Api (Symfony 2.0 to 2.3): [restapi-symfony-2-3](https://github.com/phpbenchmarks/symfony/tree/restapi-symfony-2-3)
22
+
23
+REST Api (Symfony 2.4 to 4.x): [restapi](https://github.com/phpbenchmarks/symfony/tree/restapi)
24
+
25
+Blog: [blog](https://github.com/phpbenchmarks/symfony/tree/blog)
26
+
27
+Small overload (Symfony 2.0 to 2.3): [smalloverload-symfony-2-3](https://github.com/phpbenchmarks/symfony/tree/smalloverload-symfony-2-3)
28
+
29
+Small overload (Symfony 2.4 to 4.x): [smalloverload](https://github.com/phpbenchmarks/symfony/tree/smalloverload)
30
+
31
+Big overload (Symfony 2.0 to 2.3): [bigoverload-symfony-2-3](https://github.com/phpbenchmarks/symfony/tree/bigoverload-symfony-2-3)
32
+
33
+Big overload (Symfony 2.4 to 4.x): [bigoverload](https://github.com/phpbenchmarks/symfony/tree/bigoverload)
20
 
34
 
21
 You can find how we benchmark it [here](http://www.phpbenchmarks.com/en/benchmark-protocol).
35
 You can find how we benchmark it [here](http://www.phpbenchmarks.com/en/benchmark-protocol).
22
 
36
 
23
-## Symfony
37
+## How version works ?
38
+
39
+We do not follow semantic version for this repository. Here is an explanation about our versioning system:
40
+
41
+`X` benchmark type (`1` Hello World, `2` Blog, `3` REST Api, `4` Small overload, `5` Big overload)
42
+
43
+`Y` related to Symfony version (`0` Symfony 2.0 to 2.3, `1` Symfony 3.4 to 4.x for `REST Api` benchmak for example)
44
+
45
+`Z` new version, not just bugfix and could contains BC
46
+
47
+## Symfony benchmarks
24
 
48
 
25
-You can find all Symfony benchmarks [here](http://www.phpbenchmarks.com/fr/benchmark/apache-bench/php-7.1/select-version/symfony.html).
49
+You can find all Symfony benchmarks [here](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2/select-version/symfony.html).

+ 1500
- 0
Resources/config/routing.yml
文件差异内容过多而无法显示
查看文件


Bundle/RestBundle/Resources/config/services.yml → Resources/config/services.yml 查看文件

1
 services:
1
 services:
2
     benchmark.normalizer.user:
2
     benchmark.normalizer.user:
3
-        class: PhpBenchmarksSymfony\Bundle\RestBundle\Normalizer\UserNormalizer
3
+        class: PhpBenchmarksSymfony\RestApiBundle\Normalizer\UserNormalizer
4
         public: false
4
         public: false
5
         arguments: ['@translator']
5
         arguments: ['@translator']
6
         tags:
6
         tags:
7
             - { name: serializer.normalizer }
7
             - { name: serializer.normalizer }
8
 
8
 
9
     benchmark.normalizer.comment:
9
     benchmark.normalizer.comment:
10
-        class: PhpBenchmarksSymfony\Bundle\RestBundle\Normalizer\CommentNormalizer
10
+        class: PhpBenchmarksSymfony\RestApiBundle\Normalizer\CommentNormalizer
11
         public: false
11
         public: false
12
         arguments: ['@translator']
12
         arguments: ['@translator']
13
         tags:
13
         tags:
14
             - { name: serializer.normalizer }
14
             - { name: serializer.normalizer }
15
 
15
 
16
     benchmark.normalizer.comment_type:
16
     benchmark.normalizer.comment_type:
17
-        class: PhpBenchmarksSymfony\Bundle\RestBundle\Normalizer\CommentTypeNormalizer
17
+        class: PhpBenchmarksSymfony\RestApiBundle\Normalizer\CommentTypeNormalizer
18
         public: false
18
         public: false
19
         arguments: ['@translator']
19
         arguments: ['@translator']
20
         tags:
20
         tags:
21
             - { name: serializer.normalizer }
21
             - { name: serializer.normalizer }
22
 
22
 
23
     benchmark.event_listener.define_locale:
23
     benchmark.event_listener.define_locale:
24
-        class: PhpBenchmarksSymfony\EventListener\DefineLocaleEventListener
24
+        class: PhpBenchmarksSymfony\RestApiBundle\EventListener\DefineLocaleEventListener
25
         arguments: ['@request_stack', '@translator']
25
         arguments: ['@request_stack', '@translator']
26
         tags:
26
         tags:
27
             - { name: kernel.event_listener, event: defineLocale }
27
             - { name: kernel.event_listener, event: defineLocale }

Translation/phpbenchmarks.en.yml → Resources/translations/phpbenchmarks.en.yml 查看文件


Translation/phpbenchmarks.en_GB.yml → Resources/translations/phpbenchmarks.en_GB.yml 查看文件


Translation/phpbenchmarks.fr_FR.yml → Resources/translations/phpbenchmarks.fr_FR.yml 查看文件


+ 10
- 0
RestApiBundle.php 查看文件

1
+<?php
2
+
3
+namespace PhpBenchmarksSymfony\RestApiBundle;
4
+
5
+use Symfony\Component\DependencyInjection\ContainerBuilder;
6
+use Symfony\Component\HttpKernel\Bundle\Bundle;
7
+
8
+class RestApiBundle extends Bundle
9
+{
10
+}

+ 1
- 1
composer.json 查看文件

4
     "type": "project",
4
     "type": "project",
5
     "autoload": {
5
     "autoload": {
6
         "psr-4": {
6
         "psr-4": {
7
-            "PhpBenchmarksSymfony\\": ""
7
+            "PhpBenchmarksSymfony\\RestApiBundle\\": ""
8
         }
8
         }
9
     },
9
     },
10
     "require": {
10
     "require": {

正在加载...
取消
保存