Skip to content

Commit 57d0418

Browse files
committed
Create restapi branch
1 parent cf709b6 commit 57d0418

18 files changed

+165
-3759
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ You will not find final source code here, as it's in [phpbenchmarks/symfony](htt
1818

1919
You can find how we benchmark it [here](http://www.phpbenchmarks.com/en/benchmark-protocol).
2020

21-
## Symfony 2.6.13: 20,501
22-
23-
Benchmark | PHP | Request | Rq/sec | Score
24-
--------- | --- | ------- | ------ | -----
25-
[Hello World](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2/symfony-2.6.html#benchmark-hello-world) | 7.2 | 1.5 ms | 689 | 11,992
26-
[Rest API](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2/symfony-2.6.html#benchmark-rest) | 7.2 | 2.1 ms | 485 | 8,509
21+
Each benchmark type have their own branch :
22+
[Hello World](https://github.com/phpbenchmarks/symfony-2-6/tree/helloworld),
23+
[Blog](https://github.com/phpbenchmarks/symfony-2-6/tree/blog),
24+
[REST Api](https://github.com/phpbenchmarks/symfony-2-6/tree/restapi),
25+
[Small overload](https://github.com/phpbenchmarks/symfony-2-6/tree/smalloverload)
26+
and [Big overload](https://github.com/phpbenchmarks/symfony-2-6/tree/bigoverload).
2727

2828
[See all benchmark results](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2/symfony-2.6.html)
2929

app/AppKernel.php

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,18 @@
55

66
class AppKernel extends Kernel
77
{
8-
/** @var string[] */
9-
protected $bundleClasses;
10-
11-
/**
12-
* @param string $environment
13-
* @param bool $debug
14-
* @param string[] $bundleClasses
15-
*/
16-
public function __construct($environment, $debug, array $bundleClasses = [])
17-
{
18-
parent::__construct($environment, $debug);
19-
20-
$this->bundleClasses = $bundleClasses;
21-
}
22-
238
public function registerBundles()
249
{
25-
$bundles = array(
10+
return [
2611
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
2712
new Symfony\Bundle\TwigBundle\TwigBundle(),
2813
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
29-
);
30-
foreach ($this->bundleClasses as $bundleClass) {
31-
$bundles[] = new $bundleClass();
32-
}
33-
34-
return $bundles;
14+
new PhpBenchmarksSymfony\Bundle\RestBundle\RestBundle()
15+
];
3516
}
3617

3718
public function registerContainerConfiguration(LoaderInterface $loader)
3819
{
39-
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
20+
$loader->load($this->getRootDir() . '/config/config.yml');
4021
}
4122
}

app/config/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77
framework:
88
secret: "%secret%"
99
router:
10-
resource: "%kernel.root_dir%/config/routing.yml"
10+
resource: "@RestBundle/Resources/config/routing.yml"
1111
strict_requirements: ~
1212
form: ~
1313
csrf_protection: ~
@@ -21,3 +21,7 @@ framework:
2121
handler_id: ~
2222
fragments: ~
2323
http_method_override: true
24+
serializer:
25+
enabled: true
26+
translator:
27+
enabled: true

app/config/config_helloworld.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

app/config/config_rest.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/config/parameters.yml.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
11
parameters:
2-
database_driver: pdo_mysql
3-
database_host: 127.0.0.1
4-
database_port: ~
5-
database_name: symfony
6-
database_user: root
7-
database_password: ~
82
secret: ThisTokenIsNotSoSecretChangeIt

app/config/security.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
security:
2-
32
providers:
43
in_memory:
54
memory: ~
6-
75
firewalls:
86
dev:
97
pattern: ^/(_(profiler|wdt)|css|images|js)/
108
security: false
11-
129
main:
1310
anonymous: ~

app/console

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
#!/usr/bin/env php
22
<?php
33

4-
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
5-
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
6-
//umask(0000);
7-
84
set_time_limit(0);
95

10-
require_once __DIR__.'/bootstrap.php.cache';
11-
require_once __DIR__.'/AppKernel.php';
6+
require_once __DIR__ . '/bootstrap.php.cache';
7+
require_once __DIR__ . '/AppKernel.php';
128

139
use Symfony\Bundle\FrameworkBundle\Console\Application;
1410
use Symfony\Component\Console\Input\ArgvInput;
1511
use Symfony\Component\Debug\Debug;
1612

17-
$input = new ArgvInput();
18-
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
19-
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
20-
21-
if ($debug) {
22-
Debug::enable();
23-
}
24-
25-
$kernel = new AppKernel($env, $debug);
13+
$kernel = new AppKernel('prod', false);
2614
$application = new Application($kernel);
2715
$application->run($input);

composer.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,22 @@
55
"require": {
66
"php": ">=5.3.3",
77
"symfony/symfony": "2.6.*",
8-
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
9-
"doctrine/dbal": "<2.5",
10-
"doctrine/doctrine-bundle": "~1.2",
11-
"twig/extensions": "~1.0",
12-
"symfony/assetic-bundle": "~2.3",
13-
"symfony/swiftmailer-bundle": "~2.3",
14-
"symfony/monolog-bundle": "~2.4",
158
"sensio/distribution-bundle": "~4.0",
169
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
1710
"incenteev/composer-parameter-handler": "~2.0",
1811
"phpbenchmarks/symfony": "1.0.0"
1912
},
20-
"require-dev": {
21-
"sensio/generator-bundle": "~2.3"
22-
},
2313
"scripts": {
2414
"post-install-cmd": [
2515
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
2616
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
2717
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
28-
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
2918
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
3019
],
3120
"post-update-cmd": [
3221
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
3322
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
3423
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
35-
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
3624
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
3725
]
3826
},

0 commit comments

Comments
 (0)