Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 51c25d8

Browse filesBrowse files
committed
Documented the new getProjectDir() method
1 parent 2b1dbee commit 51c25d8
Copy full SHA for 51c25d8

File tree

Expand file treeCollapse file tree

1 file changed

+32
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+32
-0
lines changed

‎reference/configuration/kernel.rst

Copy file name to clipboardExpand all lines: reference/configuration/kernel.rst
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ directory and rename it to something else (e.g. ``foo``).
5656
Root Directory
5757
~~~~~~~~~~~~~~
5858

59+
.. versionadded:: 3.3
60+
The ``getRootDir()`` method is deprecated since Symfony 3.3. Use the new
61+
``getProjectDir()`` method instead.
62+
5963
**type**: ``string`` **default**: the directory of ``AppKernel``
6064

6165
This returns the root directory of your kernel. If you use the Symfony Standard
@@ -77,6 +81,34 @@ To change this setting, override the
7781
}
7882
}
7983

84+
Project Directory
85+
~~~~~~~~~~~~~~~~~
86+
87+
.. versionadded:: 3.3
88+
The ``getProjectDir()`` method was introduced in Symfony 3.3.
89+
90+
**type**: ``string`` **default**: the directory of the project ``composer.json``
91+
92+
This returns the root directory of your Symfony project. It's calculated as
93+
the directory where the main ``composer.json`` file is stored.
94+
95+
If for some reason the ``composer.json`` file is not stored at the root of your
96+
project, you can override the :method:`Symfony\\Component\\HttpKernel\\Kernel::getProjectDir`
97+
method to return the right project directory::
98+
99+
// app/AppKernel.php
100+
101+
// ...
102+
class AppKernel extends Kernel
103+
{
104+
// ...
105+
106+
public function getProjectDir()
107+
{
108+
return realpath(__DIR__.'/../');
109+
}
110+
}
111+
80112
Cache Directory
81113
~~~~~~~~~~~~~~~
82114

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.