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
- MASTER_REQUEST = 1
- SUB_REQUEST = 2
- boot() : mixed
- Boots the current kernel.
- getBundle() : BundleInterface
- Returns a bundle.
- getBundles() : array<string|int, 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.
- getName() : string
- Gets the name of the kernel.
- getRootDir() : string
- Gets the application root dir (path of the project's Kernel class).
- 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|array<string|int, mixed>
- Returns the file path for a given bundle resource.
- registerBundles() : iteratable<string|int, mixed>|array<string|int, BundleInterface>
- Returns an array of bundles to register.
- registerContainerConfiguration() : mixed
- Loads the container configuration.
- shutdown() : mixed
- Shutdowns the kernel.
Constants
MASTER_REQUEST
public
mixed
MASTER_REQUEST
= 1
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
-
Bundle name
Tags
Return values
BundleInterface —A BundleInterface instance
getBundles()
Gets the registered bundle instances.
public
getBundles() : array<string|int, BundleInterface>
Return values
array<string|int, BundleInterface> —An array of registered bundle instances
getCacheDir()
Gets the cache directory.
public
getCacheDir() : string
Return values
string —The cache directory
getCharset()
Gets the charset of the application.
public
getCharset() : string
Return values
string —The charset
getContainer()
Gets the current container.
public
getContainer() : ContainerInterface
Return values
ContainerInterface —getEnvironment()
Gets the environment.
public
getEnvironment() : string
Return values
string —The current environment
getLogDir()
Gets the log directory.
public
getLogDir() : string
Return values
string —The log directory
getName()
Gets the name of the kernel.
public
getName() : string
Tags
Return values
string —The kernel name
getRootDir()
Gets the application root dir (path of the project's Kernel class).
public
getRootDir() : string
Tags
Return values
string —The Kernel root dir
getStartTime()
Gets the request start time (not available if debug is disabled).
public
getStartTime() : float
Return values
float —The request start timestamp
handle()
Handles a Request to convert it to a Response.
public
handle(Request $request[, int $type = self::MASTER_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::MASTER_REQUEST
-
The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
- $catch : bool = true
-
Whether to catch exceptions or not
Tags
Return values
Response —A Response instance
isDebug()
Checks if debug mode is enabled.
public
isDebug() : bool
Return values
bool —true if debug mode is enabled, false otherwise
locateResource()
Returns the file path for a given bundle resource.
public
locateResource(string $name) : string|array<string|int, mixed>
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
-
A resource name to locate
Tags
Return values
string|array<string|int, mixed> —The absolute path of the resource or an array if $first is false (array return value is deprecated)
registerBundles()
Returns an array of bundles to register.
public
registerBundles() : iteratable<string|int, mixed>|array<string|int, BundleInterface>
Return values
iteratable<string|int, mixed>|array<string|int, BundleInterface> —An iterable of bundle instances
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.