Skip to content

Commit 57e8d94

Browse files
committed
[configuration][override_dir_structure] Update override Symfony default directory structure
1 parent e75bb1e commit 57e8d94

File tree

1 file changed

+58
-3
lines changed

1 file changed

+58
-3
lines changed

configuration/override_dir_structure.rst

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,41 @@ Web front-controller::
7474
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
7575
// ...
7676

77+
.. _override-bin-dir:
78+
79+
Override the Binary Directory
80+
-----------------------------
81+
82+
You can change the binary directory by adding the ``extra.bin-dir`` option
83+
in the ``composer.json`` file:
84+
85+
.. code-block:: json
86+
87+
{
88+
"...": "...",
89+
"extra": {
90+
"...": "...",
91+
"bin-dir": "my_new_bin_dir"
92+
}
93+
}
94+
7795
.. _override-config-dir:
7896

7997
Override the Configuration Directory
8098
------------------------------------
8199

82-
The configuration directory is the only one which cannot be overridden in a
83-
Symfony application. Its location is hardcoded as the ``config/`` directory
84-
at your project root directory.
100+
You can change the configuration directory by adding the ``extra.config-dir`` option
101+
in the ``composer.json`` file:
102+
103+
.. code-block:: json
104+
105+
{
106+
"...": "...",
107+
"extra": {
108+
"...": "...",
109+
"config-dir": "my_new_config_dir"
110+
}
111+
}
85112
86113
.. _override-cache-dir:
87114

@@ -147,6 +174,34 @@ Here you have changed the location of the directory to ``var/{environment}/log/`
147174
You can also change the log directory defining an environment variable named
148175
``APP_LOG_DIR`` whose value is the full path of the log folder.
149176

177+
.. _override-src-dir:
178+
179+
Override the Source Directory
180+
-----------------------------
181+
182+
You can change the source directory by adding the ``extra.src-dir`` option
183+
and updating the ``autoload.psr-4`` option in the ``composer.json`` file:
184+
185+
.. code-block:: json
186+
187+
{
188+
"...": "...",
189+
"autoload": {
190+
"psr-4": {
191+
"App\\": "my_new_src_dir/"
192+
}
193+
},
194+
"extra": {
195+
"...": "...",
196+
"src-dir": "my_new_src_dir"
197+
}
198+
}
199+
200+
.. tip::
201+
202+
Don't forget to run the ``composer dump-autoload`` command once ``autoload.psr-4``
203+
has been changed.
204+
150205
.. _override-templates-dir:
151206

152207
Override the Templates Directory

0 commit comments

Comments
 (0)