|
| 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. |
0 commit comments