Skip to content

Commit 65edac6

Browse files
committed
Merge pull request symfony#2217 from WouterJ/ref_kernel_config
[Reference] Document AppKernel config settings
2 parents 16e732d + bb0833e commit 65edac6

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

cookbook/configuration/override_dir_structure.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ directory structure is:
2323
app.php
2424
...
2525
26+
.. _override-cache-dir:
27+
2628
Override the ``cache`` directory
2729
--------------------------------
2830

@@ -53,6 +55,8 @@ the location of the cache directory to ``app/{environment}/cache``.
5355
its own cached config files, and so each needs its own directory to store
5456
those cache files.
5557

58+
.. _override-logs-dir:
59+
5660
Override the ``logs`` directory
5761
-------------------------------
5862

reference/configuration/kernel.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. index::
2+
single: Configuration reference; Kernel class
3+
4+
Configuration in the ``AppKernel``
5+
==================================
6+
7+
Some configuration can be done in the ``AppKernel`` class (which is located in
8+
``app/AppKernel.php``. You can do this by overriding the method of the
9+
:class:`Symfony\\Component\\HttpKernel\\Kernel` class, which is extended by
10+
the ``AppKernel`` class.
11+
12+
Configuration
13+
-------------
14+
15+
* `kernel name`_
16+
* `root directory`_
17+
* `cache directory`_
18+
* `log directory`_
19+
20+
kernel name
21+
~~~~~~~~~~~
22+
23+
**type**: ``string`` **default**: ``$this->name``
24+
25+
To change this setting, override the
26+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getName` method.
27+
28+
root directory
29+
~~~~~~~~~~~~~~
30+
31+
**type**: ``string`` **default**: the directory of ``AppKernel``
32+
33+
This returns the root directory of you Symfony2 application. If you use the
34+
Symfony Standard edition, the root directory refers to the ``app`` directory.
35+
36+
To change this setting, override the
37+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getRootDir` method::
38+
39+
// app/AppKernel.php
40+
41+
// ...
42+
class AppKernel extends Kernel
43+
{
44+
// ...
45+
46+
public function getRootDir()
47+
{
48+
return realpath(parent::getRootDir().'/../');
49+
}
50+
}
51+
52+
cache directory
53+
~~~~~~~~~~~~~~~
54+
55+
**type**: ``string`` **default**: ``$this->rootDir/cache/$this->environment``
56+
57+
This returns the cache directory. You need to override the
58+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getCacheDir` method. Read
59+
":ref:`override-cache-dir`" for more information.
60+
61+
log directory
62+
~~~~~~~~~~~~~
63+
64+
**type**: ``string`` **default**: ``$this->rootDir/logs``
65+
66+
This returns the log directory. You need to override the
67+
:method:`Symfony\\Component\\HttpKernel\\Kernel::getLogDir` method. Read
68+
":ref:`override-logs-dir`" for more information.

reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Reference Documents
1212
configuration/twig
1313
configuration/monolog
1414
configuration/web_profiler
15+
configuration/kernel
1516

1617
forms/types
1718
forms/twig_reference

reference/map.rst.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
* :doc:`doctrine </reference/configuration/doctrine>`
1010
* :doc:`security </reference/configuration/security>`
1111
* :doc:`assetic </reference/configuration/assetic>`
12-
* :doc:`swiftmailer </reference/configuration/swiftmailer>`
12+
* :doc:`swiftMailer </reference/configuration/swiftmailer>`
1313
* :doc:`twig </reference/configuration/twig>`
1414
* :doc:`monolog </reference/configuration/monolog>`
1515
* :doc:`web_profiler </reference/configuration/web_profiler>`
1616

17+
* :doc:`Configuration in the Kernel </reference/configuration/kernel>`
18+
1719
* **Forms and Validation**
1820

1921
* :doc:`Form Field Type Reference</reference/forms/types>`

0 commit comments

Comments
 (0)