Kernel
abstract class Kernel implements KernelInterface, RebootableInterface, TerminableInterface
The Kernel is the heart of the Symfony system.
It manages an environment made of bundles.
Environment names must always start with a letter and they must only contain letters and numbers.
Constants
VERSION |
|
VERSION_ID |
|
MAJOR_VERSION |
|
MINOR_VERSION |
|
RELEASE_VERSION |
|
EXTRA_VERSION |
|
END_OF_MAINTENANCE |
|
END_OF_LIFE |
|
Properties
protected BundleInterface[] | $bundles | ||
protected | $container | ||
protected | $rootDir | ||
protected | $environment | ||
protected | $debug | ||
protected | $booted | ||
protected | $name | ||
protected | $startTime |
Methods
No description
No description
Boots the current kernel.
Reboots a kernel.
Shutdowns the kernel.
Gets a HTTP kernel from the container.
Gets the registered bundle instances.
Returns a bundle.
Returns the file path for a given bundle resource.
Gets the environment.
Checks if debug mode is enabled.
Gets the application root dir (path of the project's composer file).
Gets the current container.
No description
Gets the request start time (not available if debug is disabled).
Gets the cache directory.
Gets the log directory.
Gets the charset of the application.
Gets the patterns defining the classes to parse and cache for annotations.
Initializes bundles.
Gets the container class.
Gets the container's base class.
Initializes the service container.
Returns the kernel parameters.
Builds the service container.
Gets a new ContainerBuilder instance used to build the service container.
Dumps the service container to PHP code in the cache.
Removes comments from a PHP source string.
No description
No description
Details
reboot(string|null $warmupDir)
Reboots a kernel.
The getCacheDir() method of a rebootable kernel should not be called while building the container. Use the %kernel.cache_dir% parameter instead.
terminate(Request $request, Response $response)
Terminates a request/response cycle.
Should be called after sending the response and before shutting down the kernel.
Response
handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)
Handles a Request to convert it to a Response.
When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.
string|array
locateResource(string $name, string $dir = null, bool $first = true)
Returns the file path for a given bundle resource.
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.
If $dir is passed, and the first segment of the path is "Resources", this method will look for a file named:
$dir/<BundleName>/path/without/Resources
before looking in the bundle resource folder.
string
getRootDir()
deprecated
deprecated since Symfony 4.2, use getProjectDir() instead
Gets the application root dir (path of the project's Kernel class).
array
getAnnotatedClassesToCompile()
Gets the patterns defining the classes to parse and cache for annotations.
protected
build(ContainerBuilder $container)
The extension point similar to the Bundle::build() method.
Use this method to register compiler passes and manipulate the container during the building process.
protected string
getContainerBaseClass()
Gets the container's base class.
All names except Container must be fully qualified.
protected
initializeContainer()
Initializes the service container.
The cached version of the service container is used when fresh, otherwise the container is built.
protected
prepareContainer(ContainerBuilder $container)
Prepares the ContainerBuilder before it is compiled.
protected ContainerBuilder
getContainerBuilder()
Gets a new ContainerBuilder instance used to build the service container.
protected
dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass)
Dumps the service container to PHP code in the cache.
protected DelegatingLoader
getContainerLoader(ContainerInterface $container)
Returns a loader for the container.