KernelInterface
extends
HttpKernelInterface
in
The Kernel is the heart of the Symfony system.
It manages an environment made of application kernel and bundles.
Tags
Table of Contents
- MAIN_REQUEST = 1
- MASTER_REQUEST = self::MAIN_REQUEST
- SUB_REQUEST = 2
- boot() : mixed
- Boots the current kernel.
- getBundle() : BundleInterface
- Returns a bundle.
- getBundles() : array<string, BundleInterface>
- Gets the registered bundle instances.
- getCacheDir() : string
- Gets the cache directory.
- getCharset() : string
- Gets the charset of the application.
- getContainer() : ContainerInterface
- Gets the current container.
- getEnvironment() : string
- Gets the environment.
- getLogDir() : string
- Gets the log directory.
- getProjectDir() : string
- Gets the project dir (path of the project's composer file).
- getStartTime() : float
- Gets the request start time (not available if debug is disabled).
- handle() : Response
- Handles a Request to convert it to a Response.
- isDebug() : bool
- Checks if debug mode is enabled.
- locateResource() : string
- Returns the file path for a given bundle resource.
- registerBundles() : iteratable<mixed, BundleInterface>
- Returns an array of bundles to register.
- registerContainerConfiguration() : mixed
- Loads the container configuration.
- shutdown() : mixed
- Shutdowns the kernel.
Constants
MAIN_REQUEST
public
mixed
MAIN_REQUEST
= 1
MASTER_REQUEST
public
mixed
MASTER_REQUEST
= self::MAIN_REQUEST
Tags
SUB_REQUEST
public
mixed
SUB_REQUEST
= 2
Methods
boot()
Boots the current kernel.
public
boot() : mixed
Return values
mixed —getBundle()
Returns a bundle.
public
getBundle(string $name) : BundleInterface
Parameters
- $name : string
Tags
Return values
BundleInterface —getBundles()
Gets the registered bundle instances.
public
getBundles() : array<string, BundleInterface>
Return values
array<string, BundleInterface> —getCacheDir()
Gets the cache directory.
public
getCacheDir() : string
Since Symfony 5.2, the cache directory should be used for caches that are written at runtime. For caches and artifacts that can be warmed at compile-time and deployed as read-only, use the new "build directory" returned by the getBuildDir() method.
Return values
string —getCharset()
Gets the charset of the application.
public
getCharset() : string
Return values
string —getContainer()
Gets the current container.
public
getContainer() : ContainerInterface
Return values
ContainerInterface —getEnvironment()
Gets the environment.
public
getEnvironment() : string
Return values
string —getLogDir()
Gets the log directory.
public
getLogDir() : string
Return values
string —getProjectDir()
Gets the project dir (path of the project's composer file).
public
getProjectDir() : string
Return values
string —getStartTime()
Gets the request start time (not available if debug is disabled).
public
getStartTime() : float
Return values
float —handle()
Handles a Request to convert it to a Response.
public
handle(Request $request[, int $type = self::MAIN_REQUEST ][, bool $catch = true ]) : Response
When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.
Parameters
- $request : Request
- $type : int = self::MAIN_REQUEST
-
The type of the request (one of HttpKernelInterface::MAIN_REQUEST or HttpKernelInterface::SUB_REQUEST)
- $catch : bool = true
-
Whether to catch exceptions or not
Tags
Return values
Response —isDebug()
Checks if debug mode is enabled.
public
isDebug() : bool
Return values
bool —locateResource()
Returns the file path for a given bundle resource.
public
locateResource(string $name) : string
A Resource can be a file or a directory.
The resource name must follow the following pattern:
"@BundleName/path/to/a/file.something"
where BundleName is the name of the bundle and the remaining part is the relative path in the bundle.
Parameters
- $name : string
Tags
Return values
string —registerBundles()
Returns an array of bundles to register.
public
registerBundles() : iteratable<mixed, BundleInterface>
Return values
iteratable<mixed, BundleInterface> —registerContainerConfiguration()
Loads the container configuration.
public
registerContainerConfiguration(LoaderInterface $loader) : mixed
Parameters
- $loader : LoaderInterface
Return values
mixed —shutdown()
Shutdowns the kernel.
public
shutdown() : mixed
This method is mainly useful when doing functional testing.