Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Commit d89d7d2

Browse files
committed
New directory structure
1 parent fdce704 commit d89d7d2

25 files changed

+147
-116
lines changed

app/AppKernel.php

-53
This file was deleted.

app/config/routing.yml

-3
This file was deleted.

app/config/services/app.yml

-11
This file was deleted.

app/config/services/framework.yml

-21
This file was deleted.

bin/console

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env php
22
<?php
33

4+
use App\AppKernel;
45
use Symfony\Bundle\FrameworkBundle\Console\Application;
56
use Symfony\Component\Console\Input\ArgvInput;
67
use Symfony\Component\Debug\Debug;
@@ -13,7 +14,7 @@ use Symfony\Component\Debug\Debug;
1314
set_time_limit(0);
1415

1516
/** @var Composer\Autoload\ClassLoader $loader */
16-
$loader = require __DIR__.'/../app/autoload.php';
17+
$loader = require __DIR__.'/../conf/autoload.php';
1718

1819
$input = new ArgvInput();
1920
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');

composer.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
}
1111
],
1212
"autoload": {
13-
"psr-4": { "App\\": "src/" },
14-
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
13+
"psr-4": { "App\\": "src/" }
1514
},
1615
"autoload-dev": {
1716
"psr-4": { "Tests\\": "tests/" }
1817
},
1918
"require": {
20-
"php": ">=5.5.9",
19+
"php": ">=7.0.0",
2120
"symfony/symfony": "dev-autowirable_controller as 3.3.0",
2221
"doctrine/orm": "^2.5",
2322
"doctrine/doctrine-bundle": "^1.6",
@@ -52,18 +51,18 @@
5251
},
5352
"config": {
5453
"platform": {
55-
"php": "5.5.9"
54+
"php": "7.0.0"
5655
}
5756
},
5857
"extra": {
59-
"symfony-app-dir": "app",
58+
"symfony-app-dir": "conf",
6059
"symfony-bin-dir": "bin",
6160
"symfony-var-dir": "var",
6261
"symfony-web-dir": "web",
6362
"symfony-tests-dir": "tests",
6463
"symfony-assets-install": "relative",
6564
"incenteev-parameters": {
66-
"file": "app/config/parameters.yml"
65+
"file": "conf/parameters.yml"
6766
},
6867
"branch-alias": {
6968
"dev-master": "3.3-dev"

composer.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
File renamed without changes.

app/config/config.yml renamed to conf/config.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
imports:
22
- { resource: 'parameters.yml' }
33
- { resource: 'security.yml' }
4-
- { resource: 'services/*' }
4+
- { resource: 'services.yml' }
55

66
# Put parameters here that don't need to change on each machine where the app is deployed
77
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
@@ -13,7 +13,7 @@ framework:
1313
#translator: { fallbacks: ["%locale%"] }
1414
secret: "%secret%"
1515
router:
16-
resource: "%kernel.root_dir%/config/routing.yml"
16+
resource: "%kernel.root_dir%/../conf/routing.yml"
1717
strict_requirements: ~
1818
form: ~
1919
csrf_protection: ~
@@ -38,6 +38,8 @@ framework:
3838
twig:
3939
debug: "%kernel.debug%"
4040
strict_variables: "%kernel.debug%"
41+
paths:
42+
- '%kernel.root_dir%/../templates'
4143

4244
# Doctrine Configuration
4345
doctrine:

app/config/config_dev.yml renamed to conf/dev/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
imports:
2-
- { resource: config.yml }
2+
- { resource: '../config.yml' }
33

44
framework:
55
router:
6-
resource: "%kernel.root_dir%/config/routing_dev.yml"
6+
resource: "%kernel.root_dir%/../conf/dev/routing.yml"
77
strict_requirements: true
88
profiler: { only_exceptions: false }
99

app/config/routing_dev.yml renamed to conf/dev/routing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ _errors:
1111
prefix: /_error
1212

1313
_main:
14-
resource: routing.yml
14+
resource: '../routing.yml'

conf/parameters.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is auto-generated during the composer install
2+
parameters:
3+
database_host: 127.0.0.1
4+
database_port: null
5+
database_name: symfony
6+
database_user: root
7+
database_password: null
8+
mailer_transport: smtp
9+
mailer_host: 127.0.0.1
10+
mailer_user: null
11+
mailer_password: null
12+
secret: ThisTokenIsNotSoSecretChangeIt
File renamed without changes.

app/config/config_prod.yml renamed to conf/prod/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
imports:
2-
- { resource: config.yml }
2+
- { resource: '../config.yml' }
33

44
#doctrine:
55
# orm:

conf/routing.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
action:
2+
resource: "../src/Controller/"
3+
type: annotation
File renamed without changes.

conf/services.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Learn more about services, parameters and containers at
2+
# http://symfony.com/doc/current/service_container.html
3+
parameters:
4+
# parameter_name: value
5+
6+
services:
7+
# 'My\ClassName': ~
8+
9+
# Auto-register common directories
10+
_defaults:
11+
# Enable constructor and getter autowiring for all services defined in this file
12+
autowire: ['__construct', 'get*']
13+
public: false
14+
15+
_instanceof:
16+
# Add some common tags to enable feature auto-registration
17+
Symfony\Component\Console\Command\Command:
18+
tags: ['console.command']
19+
public: true # Mandatory
20+
21+
Twig_ExtensionInterface:
22+
tags: ['twig.extension']
23+
24+
Symfony\Component\EventDispatcher\EventSubscriberInterface:
25+
tags: ['kernel.event_subscriber']
26+
27+
Symfony\Component\Form\FormTypeInterface:
28+
tags: ['form.type']
29+
public: true # Mandatory
30+
31+
Symfony\Component\Security\Core\Authorization\VoterInterface:
32+
tags: ['security.voter']
33+
34+
# Register all classes in these directories as services
35+
App\:
36+
resource: '../src/{Command,EventSubscriber,Twig,Form,Voter}'
37+
38+
App\Controller\:
39+
resource: '../src/Controller'
40+
public: true # Mandatory

app/config/config_test.yml renamed to conf/test/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
imports:
2-
- { resource: config_dev.yml }
2+
- { resource: '../dev/config.yml' }
33

44
framework:
55
test: ~

app/AppCache.php renamed to src/AppCache.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace App;
4+
35
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
46

57
class AppCache extends HttpCache

src/AppKernel.php

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
6+
use Sensio\Bundle\DistributionBundle\SensioDistributionBundle;
7+
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
8+
use Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle;
9+
use Symfony\Bundle\DebugBundle\DebugBundle;
10+
use Symfony\Bundle\MonologBundle\MonologBundle;
11+
use Symfony\Bundle\SecurityBundle\SecurityBundle;
12+
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle;
13+
use Symfony\Bundle\TwigBundle\TwigBundle;
14+
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
15+
use Symfony\Bundle\WebServerBundle\WebServerBundle;
16+
use Symfony\Component\HttpKernel\Kernel;
17+
use Symfony\Component\Config\Loader\LoaderInterface;
18+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
19+
20+
class AppKernel extends Kernel
21+
{
22+
public function registerBundles()
23+
{
24+
$bundles = [
25+
new FrameworkBundle(),
26+
new SecurityBundle(),
27+
new MonologBundle(),
28+
new SwiftmailerBundle(),
29+
new TwigBundle(),
30+
new DoctrineBundle(),
31+
new SensioFrameworkExtraBundle(),
32+
];
33+
34+
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
35+
$bundles[] = new DebugBundle();
36+
$bundles[] = new WebProfilerBundle();
37+
$bundles[] = new SensioDistributionBundle();
38+
39+
if ('dev' === $this->getEnvironment()) {
40+
$bundles[] = new SensioGeneratorBundle();
41+
$bundles[] = new WebServerBundle();
42+
}
43+
}
44+
45+
return $bundles;
46+
}
47+
48+
public function getRootDir()
49+
{
50+
return __DIR__;
51+
}
52+
53+
public function getCacheDir()
54+
{
55+
return dirname(__DIR__).'/../var/cache/'.$this->getEnvironment();
56+
}
57+
58+
public function getLogDir()
59+
{
60+
return dirname(__DIR__).'/../var/logs';
61+
}
62+
63+
public function registerContainerConfiguration(LoaderInterface $loader)
64+
{
65+
$loader->load($this->getRootDir().'/../conf/'.$this->getEnvironment().'/config.yml');
66+
}
67+
}

app/Resources/views/default/index.html.twig renamed to templates/default/index.html.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends 'base.html.twig' %}
1+
{% extends 'layout.html.twig' %}
22

33
{% block body %}
44
<div id="wrapper">
File renamed without changes.

web/app.php

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
<?php
22

3+
use App\AppCache;
4+
use App\AppKernel;
35
use Symfony\Component\HttpFoundation\Request;
46

57
/** @var \Composer\Autoload\ClassLoader $loader */
6-
$loader = require __DIR__.'/../app/autoload.php';
7-
if (PHP_VERSION_ID < 70000) {
8-
include_once __DIR__.'/../var/bootstrap.php.cache';
9-
}
10-
8+
$loader = require __DIR__.'/../conf/autoload.php';
119
$kernel = new AppKernel('prod', false);
12-
if (PHP_VERSION_ID < 70000) {
13-
$kernel->loadClassCache();
14-
}
1510
//$kernel = new AppCache($kernel);
1611

1712
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter

web/app_dev.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use App\AppKernel;
34
use Symfony\Component\HttpFoundation\Request;
45
use Symfony\Component\Debug\Debug;
56

@@ -19,13 +20,10 @@
1920
}
2021

2122
/** @var \Composer\Autoload\ClassLoader $loader */
22-
$loader = require __DIR__.'/../app/autoload.php';
23+
$loader = require __DIR__.'/../conf/autoload.php';
2324
Debug::enable();
2425

2526
$kernel = new AppKernel('dev', true);
26-
if (PHP_VERSION_ID < 70000) {
27-
$kernel->loadClassCache();
28-
}
2927
$request = Request::createFromGlobals();
3028
$response = $kernel->handle($request);
3129
$response->send();

0 commit comments

Comments
 (0)