Skip to content

Commit 54e147b

Browse files
committed
Use phpbenchmarks/symfony dependency
1 parent 80aca66 commit 54e147b

File tree

20 files changed

+243
-419
lines changed

20 files changed

+243
-419
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
3.1
2-
===
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>
36

4-
A Symfony project created on October 9, 2017, 3:29 pm.
7+
## What is www.phpbenchmarks.com ?
8+
9+
You will find lot of benchmarks for PHP frameworks, ORM and libs here.
10+
11+
You can compare results between Apache Bench and Siege, PHP 5.6 to 7.2 and versions of your favorites PHP code.
12+
13+
## What is this repository ?
14+
15+
It's benchmark source code for Symfony 3.1.
16+
17+
You will not find final source code here, as it's in [phpbenchmarks/symfony](https://github.com/phpbenchmarks/symfony/tree/1.0.0) dependency.
18+
19+
You can find how we benchmark it [here](http://www.phpbenchmarks.com/en/benchmark-protocol).
20+
21+
## Symfony 3.1.10
22+
23+
Benchmark | Tool | PHP | Score
24+
--------- | ---- | --- | -----
25+
[Hello World](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.1/symfony-3.1.html#benchmark-hello-world) | Apache Bench | 7.1 | In progress
26+
[News](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.1/symfony-3.1.html#benchmark-news) | Apache Bench | 7.1 | In progress
27+
[Rest API](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.1/symfony-3.1.html#benchmark-rest) | Apache Bench | 7.1 | In progress
28+
29+
Scores are too low ? Do not hesitate to create a pull request, and ask a new benchmark !

app/AppKernel.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,31 @@
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+
823
public function registerBundles()
924
{
10-
$bundles = [
25+
$bundles = array(
1126
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
12-
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
1327
new Symfony\Bundle\TwigBundle\TwigBundle(),
14-
new Symfony\Bundle\MonologBundle\MonologBundle(),
15-
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
16-
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
1728
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
18-
new PHPBenchmarks\BenchmarkBundle\BenchmarkBundle()
19-
];
29+
);
30+
foreach ($this->bundleClasses as $bundleClass) {
31+
$bundles[] = new $bundleClass();
32+
}
2033

2134
return $bundles;
2235
}
@@ -28,16 +41,16 @@ public function getRootDir()
2841

2942
public function getCacheDir()
3043
{
31-
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
44+
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
3245
}
3346

3447
public function getLogDir()
3548
{
36-
return dirname(__DIR__).'/var/logs';
49+
return dirname(__DIR__) . '/var/logs';
3750
}
3851

3952
public function registerContainerConfiguration(LoaderInterface $loader)
4053
{
41-
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
54+
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
4255
}
4356
}

app/config/config.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,25 @@
11
imports:
22
- { resource: parameters.yml }
3-
- { resource: security.yml }
43

5-
# Put parameters here that don't need to change on each machine where the app is deployed
6-
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
74
parameters:
85
locale: en
96

107
framework:
11-
#esi: ~
12-
#translator: { fallbacks: ["%locale%"] }
138
secret: "%secret%"
149
router:
1510
resource: "%kernel.root_dir%/config/routing.yml"
1611
strict_requirements: ~
1712
form: ~
1813
csrf_protection: ~
1914
validation: { enable_annotations: true }
20-
#serializer: { enable_annotations: true }
2115
templating:
2216
engines: ['twig']
2317
default_locale: "%locale%"
2418
trusted_hosts: ~
2519
trusted_proxies: ~
2620
session:
27-
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
2821
handler_id: session.handler.native_file
2922
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
3023
fragments: ~
3124
http_method_override: true
3225
assets: ~
33-
34-
# Twig Configuration
35-
twig:
36-
debug: "%kernel.debug%"
37-
strict_variables: "%kernel.debug%"
38-
39-
# Doctrine Configuration
40-
doctrine:
41-
dbal:
42-
driver: pdo_mysql
43-
host: "%database_host%"
44-
port: "%database_port%"
45-
dbname: "%database_name%"
46-
user: "%database_user%"
47-
password: "%database_password%"
48-
charset: UTF8
49-
# if using pdo_sqlite as your database driver:
50-
# 1. add the path in parameters.yml
51-
# e.g. database_path: "%kernel.root_dir%/../var/data/data.sqlite"
52-
# 2. Uncomment database_path in parameters.yml.dist
53-
# 3. Uncomment next line:
54-
#path: "%database_path%"
55-
56-
orm:
57-
auto_generate_proxy_classes: "%kernel.debug%"
58-
naming_strategy: doctrine.orm.naming_strategy.underscore
59-
auto_mapping: true
60-
61-
# Swiftmailer Configuration
62-
swiftmailer:
63-
transport: "%mailer_transport%"
64-
host: "%mailer_host%"
65-
username: "%mailer_user%"
66-
password: "%mailer_password%"
67-
spool: { type: memory }

app/config/config_helloworld.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
imports:
2+
- { resource: config.yml }
3+
4+
framework:
5+
router:
6+
resource: "@HelloWorldBundle/Resources/config/routing.yml"

app/config/config_prod.yml

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

app/config/config_rest.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
imports:
2+
- { resource: config.yml }
3+
4+
framework:
5+
router:
6+
resource: "@RestBundle/Resources/config/routing.yml"
7+
serializer:
8+
enabled: true
9+
translator:
10+
enabled: true

app/config/parameters.yml.dist

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
# This file is a "template" of what your parameters.yml file should look like
2-
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
3-
# http://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
41
parameters:
5-
database_host: 127.0.0.1
6-
database_port: ~
7-
database_name: symfony
8-
database_user: root
2+
database_host: 127.0.0.1
3+
database_port: ~
4+
database_name: symfony
5+
database_user: root
96
database_password: ~
10-
# You should uncomment this if you want use pdo_sqlite
11-
# database_path: "%kernel.root_dir%/data.db3"
12-
13-
mailer_transport: smtp
14-
mailer_host: 127.0.0.1
15-
mailer_user: ~
16-
mailer_password: ~
17-
18-
# A secret key that's used to generate certain security-related tokens
19-
secret: ThisTokenIsNotSoSecretChangeIt
7+
secret: ThisTokenIsNotSoSecretChangeIt

app/config/routing.yml

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

composer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
2-
"name": "infodroid/3.1",
2+
"name": "phpbenchmarks/symfony-3-1",
33
"license": "proprietary",
44
"type": "project",
55
"autoload": {
6-
"psr-4": {
7-
"": "src/"
8-
},
96
"classmap": [
107
"app/AppKernel.php",
118
"app/AppCache.php"
@@ -22,7 +19,8 @@
2219
"symfony/polyfill-apcu": "^1.0",
2320
"sensio/distribution-bundle": "^5.0",
2421
"sensio/framework-extra-bundle": "^3.0.2",
25-
"incenteev/composer-parameter-handler": "^2.0"
22+
"incenteev/composer-parameter-handler": "^2.0",
23+
"phpbenchmarks/symfony": "1.0.0"
2624
},
2725
"require-dev": {
2826
"sensio/generator-bundle": "^3.0",

0 commit comments

Comments
 (0)