Skip to content

Commit f2be12a

Browse files
committed
Updated directory structures
1 parent df20095 commit f2be12a

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

cookbook/configuration/configuration_organization.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ default Symfony Standard Edition follow this structure:
3434

3535
.. code-block:: text
3636
37-
<your-project>/
37+
your-project/
3838
├─ app/
3939
│ └─ config/
4040
│ ├─ config.yml
@@ -47,6 +47,8 @@ default Symfony Standard Edition follow this structure:
4747
│ ├─ routing_dev.yml
4848
│ └─ security.yml
4949
├─ src/
50+
├─ tests/
51+
├─ var/
5052
├─ vendor/
5153
└─ web/
5254
@@ -65,7 +67,7 @@ name as the environment:
6567

6668
.. code-block:: text
6769
68-
<your-project>/
70+
your-project/
6971
├─ app/
7072
│ └─ config/
7173
│ ├─ common/
@@ -84,6 +86,8 @@ name as the environment:
8486
│ ├─ routing.yml
8587
│ └─ security.yml
8688
├─ src/
89+
├─ tests/
90+
├─ var/
8791
├─ vendor/
8892
└─ web/
8993
@@ -161,7 +165,7 @@ and several files to define all application services:
161165

162166
.. code-block:: text
163167
164-
<your-project>/
168+
your-project/
165169
├─ app/
166170
│ └─ config/
167171
│ ├─ bundles/
@@ -183,6 +187,8 @@ and several files to define all application services:
183187
│ ├─ ...
184188
│ └─ security.yml
185189
├─ src/
190+
├─ tests/
191+
├─ var/
186192
├─ vendor/
187193
└─ web/
188194

cookbook/configuration/environments.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ However, each environment caches its own set of files:
347347

348348
.. code-block:: text
349349
350-
<your-project>/
350+
your-project/
351351
├─ var/
352352
│ ├─ cache/
353353
│ │ ├─ dev/ # cache directory for the *dev* environment

cookbook/configuration/override_dir_structure.rst

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ directory structure is:
1212
1313
your-project/
1414
├─ app/
15-
│ ├─ cache/
1615
│ ├─ config/
17-
│ ├─ logs/
1816
│ └─ ...
1917
├─ src/
2018
│ └─ ...
19+
├─ tests/
20+
│ └─ ...
21+
├─ var/
22+
│ ├─ cache/
23+
│ ├─ logs/
24+
│ └─ ...
2125
├─ vendor/
2226
│ └─ ...
2327
└─ web/
@@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application::
4145

4246
public function getCacheDir()
4347
{
44-
return $this->rootDir.'/'.$this->environment.'/cache';
48+
return dirname(__DIR__).'/var/'.$this->environment.'/cache';
4549
}
4650
}
4751

48-
``$this->rootDir`` is the absolute path to the ``app`` directory and ``$this->environment``
49-
is the current environment (i.e. ``dev``). In this case you have changed
50-
the location of the cache directory to ``app/{environment}/cache``.
52+
In this code, ``$this->environment`` is the current environment (i.e. ``dev``).
53+
In this case you have changed the location of the cache directory to
54+
``var/{environment}/cache``.
5155

5256
.. caution::
5357

@@ -74,34 +78,34 @@ method::
7478

7579
public function getLogDir()
7680
{
77-
return $this->rootDir.'/'.$this->environment.'/logs';
81+
return dirname(__DIR__).'/var/'.$this->environment.'/logs';
7882
}
7983
}
8084

81-
Here you have changed the location of the directory to ``app/{environment}/logs``.
85+
Here you have changed the location of the directory to ``var/{environment}/logs``.
8286

8387
.. _override-web-dir:
8488

8589
Override the ``web`` Directory
8690
------------------------------
8791

8892
If you need to rename or move your ``web`` directory, the only thing you
89-
need to guarantee is that the path to the ``app`` directory is still correct
93+
need to guarantee is that the path to the ``var`` directory is still correct
9094
in your ``app.php`` and ``app_dev.php`` front controllers. If you simply
9195
renamed the directory, you're fine. But if you moved it in some way, you
9296
may need to modify these paths inside those files::
9397

94-
require_once __DIR__.'/../Symfony/var/bootstrap.php.cache';
98+
require_once __DIR__.'/../path/to/var/bootstrap.php.cache';
9599

96-
You also need to change the ``extra.symfony-web-dir`` option in the ``composer.json``
97-
file:
100+
You also need to change the ``extra.symfony-web-dir`` option in the
101+
``composer.json`` file:
98102

99-
.. code-block:: javascript
103+
.. code-block:: json
100104
101105
{
102-
...
106+
"...": "...",
103107
"extra": {
104-
...
108+
"...": "...",
105109
"symfony-web-dir": "my_new_web_dir"
106110
}
107111
}
@@ -178,6 +182,7 @@ The change in the ``composer.json`` will look like this:
178182
Then, update the path to the ``autoload.php`` file in ``app/autoload.php``::
179183

180184
// app/autoload.php
185+
181186
// ...
182187
$loader = require '/some/dir/vendor/autoload.php';
183188

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy