Kernel
extends Kernel
in package
Uses
MicroKernelTrait
The Kernel is the heart of the Symfony system.
Tags
Table of Contents
- CONFIG_EXTS = '.{php,xml,yaml,yml}'
- END_OF_LIFE = '11/2025'
- END_OF_MAINTENANCE = '11/2024'
- EXTRA_VERSION = ''
- MAJOR_VERSION = 5
- MINOR_VERSION = 4
- RELEASE_VERSION = 38
- VERSION = '5.4.38'
- VERSION_ID = 50438
- $booted : mixed
- $bundles : array<string, BundleInterface>
- $container : mixed
- $debug : mixed
- $environment : mixed
- $startTime : mixed
- $freshCache : array<string, bool>
- $projectDir : mixed
- $requestStackSize : mixed
- $resetServices : mixed
- $warmupDir : mixed
- __clone() : mixed
- __construct() : mixed
- __sleep() : array<string|int, mixed>
- __wakeup() : mixed
- boot() : mixed
- Boots the current kernel.
- build() : void
- The extension point similar to the Bundle::build() method.
- getAnnotatedClassesToCompile() : array<string|int, mixed>
- Gets the patterns defining the classes to parse and cache for annotations.
- getBuildDir() : string
- {@inheritdoc}
- 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
- Override needed for auto-detection when installed using Composer.
- getStartTime() : float
- Gets the request start time (not available if debug is disabled).
- getWorkingDir() : string
- Returns the current working directory.
- handle() : mixed
- {@inheritdoc}
- isDebug() : bool
- Checks if debug mode is enabled.
- isPhar() : bool
- locateResource() : string
- Returns the file path for a given bundle resource.
- reboot() : mixed
- Reboots a kernel.
- registerBundles() : iteratable<string|int, mixed>
- registerContainerConfiguration() : mixed
- {@inheritdoc}
- shutdown() : mixed
- Shutdowns the kernel.
- stripComments() : string
- Removes comments from a PHP source string.
- terminate() : mixed
- Terminates a request/response cycle.
- buildContainer() : ContainerBuilder
- Builds the service container.
- configureContainer() : void
- configureRoutes() : void
- dumpContainer() : mixed
- Dumps the service container to PHP code in the cache.
- getContainerBaseClass() : string
- Gets the container's base class.
- getContainerBuilder() : ContainerBuilder
- Gets a new ContainerBuilder instance used to build the service container.
- getContainerClass() : string
- Gets the container class.
- getContainerLoader() : DelegatingLoader
- Returns a loader for the container.
- getHttpKernel() : HttpKernelInterface
- Gets an HTTP kernel from the container.
- getKernelParameters() : array<string|int, mixed>
- Returns the kernel parameters.
- initializeBundles() : mixed
- Initializes bundles.
- initializeContainer() : mixed
- Initializes the service container.
- prepareContainer() : mixed
- Prepares the ContainerBuilder before it is compiled.
- getBundlesPath() : string
- Gets the path to the bundles configuration file.
- getConfigDir() : string
- Gets the path to the configuration directory.
- preBoot() : ContainerInterface
Constants
CONFIG_EXTS
public
mixed
CONFIG_EXTS
= '.{php,xml,yaml,yml}'
END_OF_LIFE
public
mixed
END_OF_LIFE
= '11/2025'
END_OF_MAINTENANCE
public
mixed
END_OF_MAINTENANCE
= '11/2024'
EXTRA_VERSION
public
mixed
EXTRA_VERSION
= ''
MAJOR_VERSION
public
mixed
MAJOR_VERSION
= 5
MINOR_VERSION
public
mixed
MINOR_VERSION
= 4
RELEASE_VERSION
public
mixed
RELEASE_VERSION
= 38
VERSION
public
mixed
VERSION
= '5.4.38'
VERSION_ID
public
mixed
VERSION_ID
= 50438
Properties
$booted
protected
mixed
$booted
= false
$bundles
protected
array<string, BundleInterface>
$bundles
= []
$container
protected
mixed
$container
$debug
protected
mixed
$debug
$environment
protected
mixed
$environment
$startTime
protected
mixed
$startTime
$freshCache
private
static array<string, bool>
$freshCache
= []
$projectDir
private
mixed
$projectDir
$requestStackSize
private
mixed
$requestStackSize
= 0
$resetServices
private
mixed
$resetServices
= false
$warmupDir
private
mixed
$warmupDir
Methods
__clone()
public
__clone() : mixed
Return values
mixed —__construct()
public
__construct(string $environment, bool $debug) : mixed
Parameters
- $environment : string
- $debug : bool
Return values
mixed —__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed> —__wakeup()
public
__wakeup() : mixed
Return values
mixed —boot()
Boots the current kernel.
public
boot() : mixed
Return values
mixed —build()
The extension point similar to the Bundle::build() method.
public
build(ContainerBuilder $container) : void
Use this method to register compiler passes and manipulate the container during the building process.
Parameters
- $container : ContainerBuilder
Return values
void —getAnnotatedClassesToCompile()
Gets the patterns defining the classes to parse and cache for annotations.
public
getAnnotatedClassesToCompile() : array<string|int, mixed>
Return values
array<string|int, mixed> —getBuildDir()
{@inheritdoc}
public
getBuildDir() : string
Return values
string —getBundle()
Returns a bundle.
public
getBundle(string $name) : BundleInterface
Parameters
- $name : string
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
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()
Override needed for auto-detection when installed using Composer.
public
getProjectDir() : string
I am not quite sure why, but without this overridden method Symfony will use the 'src' directory as Project Dir when phpDocumentor is installed using Composer. Without being installed with composer it works fine without this hack.
Return values
string —getStartTime()
Gets the request start time (not available if debug is disabled).
public
getStartTime() : float
Return values
float —getWorkingDir()
Returns the current working directory.
public
getWorkingDir() : string
By default, symfony does not track the current working directory. Since we want to use this information to locate certain resources, such as the configuration files, we add a new method in the kernel that can be used as an expression to be passed to service definitions.
For example:
phpDocumentor\Configuration\ConfigurationFactory:
arguments:
$defaultFiles:
- "@=service('kernel').getWorkingDir() ~ '/phpdoc.xml'"
- "@=service('kernel').getWorkingDir() ~ '/phpdoc.dist.xml'"
- "@=service('kernel').getWorkingDir() ~ '/phpdoc.xml.dist'"
Return values
string —handle()
{@inheritdoc}
public
handle(Request $request[, int $type = HttpKernelInterface::MAIN_REQUEST ][, bool $catch = true ]) : mixed
Parameters
- $request : Request
- $type : int = HttpKernelInterface::MAIN_REQUEST
- $catch : bool = true
Return values
mixed —isDebug()
Checks if debug mode is enabled.
public
isDebug() : bool
Return values
bool —isPhar()
public
static isPhar() : bool
Return values
bool —locateResource()
Returns the file path for a given bundle resource.
public
locateResource(string $name) : string
Parameters
- $name : string
Return values
string —reboot()
Reboots a kernel.
public
reboot(string|null $warmupDir) : mixed
Parameters
- $warmupDir : string|null
-
pass null to reboot in the regular build directory
Return values
mixed —registerBundles()
public
registerBundles() : iteratable<string|int, mixed>
Return values
iteratable<string|int, mixed> —registerContainerConfiguration()
{@inheritdoc}
public
registerContainerConfiguration(LoaderInterface $loader) : mixed
Parameters
- $loader : LoaderInterface
Return values
mixed —shutdown()
Shutdowns the kernel.
public
shutdown() : mixed
Return values
mixed —stripComments()
Removes comments from a PHP source string.
public
static stripComments(string $source) : string
We don't use the PHP php_strip_whitespace() function as we want the content to be readable and well-formatted.
Parameters
- $source : string
Return values
string —terminate()
Terminates a request/response cycle.
public
terminate(Request $request, Response $response) : mixed
Parameters
Return values
mixed —buildContainer()
Builds the service container.
protected
buildContainer() : ContainerBuilder
Tags
Return values
ContainerBuilder —configureContainer()
protected
configureContainer(ContainerBuilder $c, LoaderInterface $loader) : void
Parameters
- $c : ContainerBuilder
- $loader : LoaderInterface
Return values
void —configureRoutes()
protected
configureRoutes(RouteCollectionBuilder $routes) : void
Parameters
- $routes : RouteCollectionBuilder
Return values
void —dumpContainer()
Dumps the service container to PHP code in the cache.
protected
dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass) : mixed
Parameters
- $cache : ConfigCache
- $container : ContainerBuilder
- $class : string
-
The name of the class to generate
- $baseClass : string
-
The name of the container's base class
Return values
mixed —getContainerBaseClass()
Gets the container's base class.
protected
getContainerBaseClass() : string
All names except Container must be fully qualified.
Return values
string —getContainerBuilder()
Gets a new ContainerBuilder instance used to build the service container.
protected
getContainerBuilder() : ContainerBuilder
Return values
ContainerBuilder —getContainerClass()
Gets the container class.
protected
getContainerClass() : string
Tags
Return values
string —getContainerLoader()
Returns a loader for the container.
protected
getContainerLoader(ContainerInterface $container) : DelegatingLoader
Parameters
- $container : ContainerInterface
Return values
DelegatingLoader —getHttpKernel()
Gets an HTTP kernel from the container.
protected
getHttpKernel() : HttpKernelInterface
Return values
HttpKernelInterface —getKernelParameters()
Returns the kernel parameters.
protected
getKernelParameters() : array<string|int, mixed>
Return values
array<string|int, mixed> —initializeBundles()
Initializes bundles.
protected
initializeBundles() : mixed
Tags
Return values
mixed —initializeContainer()
Initializes the service container.
protected
initializeContainer() : mixed
The built version of the service container is used when fresh, otherwise the container is built.
Return values
mixed —prepareContainer()
Prepares the ContainerBuilder before it is compiled.
protected
prepareContainer(ContainerBuilder $container) : mixed
Parameters
- $container : ContainerBuilder
Return values
mixed —getBundlesPath()
Gets the path to the bundles configuration file.
private
getBundlesPath() : string
Return values
string —getConfigDir()
Gets the path to the configuration directory.
private
getConfigDir() : string
Return values
string —preBoot()
private
preBoot() : ContainerInterface