Skip to content

Commit e21ff9b

Browse files
committed
Use phpbenchmarks/symfony dependency
1 parent 5ed3a24 commit e21ff9b

24 files changed

+3777
-428
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
2.4
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>
6+
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 2.4.
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 2.4.10
22+
23+
Benchmark | Tool | PHP | Score
24+
--------- | ---- | --- | -----
25+
[Hello World](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.1/symfony-2.4.html#benchmark-hello-world) | Apache Bench | 7.1 | In progress
26+
[News](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.1/symfony-2.4.html#benchmark-news) | Apache Bench | 7.1 | In progress
27+
[Rest API](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.1/symfony-2.4.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: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,37 @@
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
{
1025
$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 Symfony\Bundle\AsseticBundle\AsseticBundle(),
17-
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
1828
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
19-
new PHPBenchmarks\BenchmarkBundle\BenchmarkBundle()
2029
);
21-
22-
if (in_array($this->getEnvironment(), array('dev'))) {
23-
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
24-
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
25-
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
30+
foreach ($this->bundleClasses as $bundleClass) {
31+
$bundles[] = new $bundleClass();
2632
}
2733

2834
return $bundles;
2935
}
3036

3137
public function registerContainerConfiguration(LoaderInterface $loader)
3238
{
33-
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
39+
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
3440
}
3541
}

app/config/config.yml

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,22 @@
11
imports:
22
- { resource: parameters.yml }
3-
- { resource: security.yml }
3+
4+
parameters:
5+
locale: en
46

57
framework:
6-
#esi: ~
7-
#translator: { fallback: "%locale%" }
8-
secret: "%secret%"
8+
secret: "%secret%"
99
router:
10-
resource: "%kernel.root_dir%/config/routing.yml"
1110
strict_requirements: ~
12-
form: ~
11+
form: ~
1312
csrf_protection: ~
14-
validation: { enable_annotations: true }
13+
validation: { enable_annotations: true }
1514
templating:
1615
engines: ['twig']
17-
#assets_version: SomeVersionScheme
18-
default_locale: "%locale%"
19-
trusted_hosts: ~
16+
default_locale: "%locale%"
17+
trusted_hosts: ~
2018
trusted_proxies: ~
2119
session:
22-
# handler_id set to null will use default session handler from php.ini
2320
handler_id: ~
24-
fragments: ~
21+
fragments: ~
2522
http_method_override: true
26-
27-
# Twig Configuration
28-
twig:
29-
debug: "%kernel.debug%"
30-
strict_variables: "%kernel.debug%"
31-
32-
# Assetic Configuration
33-
assetic:
34-
debug: "%kernel.debug%"
35-
use_controller: false
36-
bundles: [ ]
37-
#java: /usr/bin/java
38-
filters:
39-
cssrewrite: ~
40-
#closure:
41-
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
42-
#yui_css:
43-
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
44-
45-
# Doctrine Configuration
46-
doctrine:
47-
dbal:
48-
driver: "%database_driver%"
49-
host: "%database_host%"
50-
port: "%database_port%"
51-
dbname: "%database_name%"
52-
user: "%database_user%"
53-
password: "%database_password%"
54-
charset: UTF8
55-
# if using pdo_sqlite as your database driver, add the path in parameters.yml
56-
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
57-
# path: "%database_path%"
58-
59-
orm:
60-
auto_generate_proxy_classes: "%kernel.debug%"
61-
auto_mapping: true
62-
63-
# Swiftmailer Configuration
64-
swiftmailer:
65-
transport: "%mailer_transport%"
66-
host: "%mailer_host%"
67-
username: "%mailer_user%"
68-
password: "%mailer_password%"
69-
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 & 25 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: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
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
2+
database_driver: pdo_mysql
3+
database_host: 127.0.0.1
4+
database_port: ~
5+
database_name: symfony
6+
database_user: root
77
database_password: ~
8-
9-
mailer_transport: smtp
10-
mailer_host: 127.0.0.1
11-
mailer_user: ~
12-
mailer_password: ~
13-
14-
locale: en
15-
secret: ThisTokenIsNotSoSecretChangeIt
8+
secret: ThisTokenIsNotSoSecretChangeIt

app/config/routing.yml

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

app/config/security.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,16 @@ security:
33
Symfony\Component\Security\Core\User\User: plaintext
44

55
role_hierarchy:
6-
ROLE_ADMIN: ROLE_USER
6+
ROLE_ADMIN: ROLE_USER
77
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
88

99
providers:
10-
in_memory:
11-
memory:
12-
users:
13-
user: { password: userpass, roles: [ 'ROLE_USER' ] }
14-
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
10+
in_memory: ~
1511

1612
firewalls:
1713
dev:
18-
pattern: ^/(_(profiler|wdt)|css|images|js)/
14+
pattern: ^/(_(profiler|wdt)|css|images|js)/
1915
security: false
2016

21-
login:
22-
pattern: ^/demo/secured/login$
23-
security: false
24-
25-
secured_area:
26-
pattern: ^/demo/secured/
27-
form_login:
28-
check_path: _security_check
29-
login_path: _demo_login
30-
logout:
31-
path: _demo_logout
32-
target: _demo
33-
#anonymous: ~
34-
#http_basic:
35-
# realm: "Secured Demo Area"
36-
3717
access_control:
3818
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }

composer.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
22
"name": "phpbenchmarks/symfony-2-4",
3-
"license": "MIT",
3+
"license": "proprietary",
44
"type": "project",
5-
"autoload": {
6-
"psr-0": { "": "src/" }
7-
},
85
"require": {
96
"php": ">=5.3.3",
107
"symfony/symfony": "2.4.*",
@@ -17,21 +14,18 @@
1714
"sensio/distribution-bundle": "~2.3",
1815
"sensio/framework-extra-bundle": "~3.0",
1916
"sensio/generator-bundle": "~2.3",
20-
"incenteev/composer-parameter-handler": "~2.0"
17+
"incenteev/composer-parameter-handler": "~2.0",
18+
"phpbenchmarks/symfony": "1.0.0"
2119
},
2220
"scripts": {
2321
"post-install-cmd": [
2422
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
2523
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
26-
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
27-
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
2824
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
2925
],
3026
"post-update-cmd": [
3127
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
3228
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
33-
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
34-
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
3529
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
3630
]
3731
},

0 commit comments

Comments
 (0)