Kernel
class Kernel implements KernelInterface, TerminableInterface
The Kernel is the heart of the Symfony system.
It manages an environment made of bundles.
Constants
VERSION |
|
VERSION_ID |
|
MAJOR_VERSION |
|
MINOR_VERSION |
|
RELEASE_VERSION |
|
EXTRA_VERSION |
|
END_OF_MAINTENANCE |
|
END_OF_LIFE |
|
Methods
Constructor.
No description
Boots the current kernel.
Shutdowns the kernel.
Gets the registered bundle instances.
Returns a bundle and optionally its descendants by its name.
Returns the file path for a given resource.
Gets the name of the kernel.
Gets the environment.
Checks if debug mode is enabled.
Gets the application root dir.
Gets the current container.
Loads the PHP class cache.
Used internally.
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.
Removes comments from a PHP source string.
No description
No description
Details
at line line 78
__construct(string $environment, bool $debug)
Constructor.
at line line 90
__clone()
at line line 103
boot()
Boots the current kernel.
at line line 130
terminate(Request $request, Response $response)
Terminates a request/response cycle.
Should be called after sending the response and before shutting down the kernel.
at line line 144
shutdown()
Shutdowns the kernel.
This method is mainly useful when doing functional testing.
at line line 163
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.
at line line 185
BundleInterface[]
getBundles()
Gets the registered bundle instances.
at line line 193
BundleInterface|BundleInterface[]
getBundle(string $name, bool $first = true)
Returns a bundle and optionally its descendants by its name.
at line line 211
string|array
locateResource(string $name, string $dir = null, bool $first = true)
Returns the file path for a given 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.
at line line 268
string
getName()
Gets the name of the kernel.
at line line 280
string
getEnvironment()
Gets the environment.
at line line 288
bool
isDebug()
Checks if debug mode is enabled.
at line line 296
string
getRootDir()
Gets the application root dir.
at line line 309
ContainerInterface
getContainer()
Gets the current container.
at line line 326
loadClassCache(string $name = 'classes', string $extension = '.php')
Loads the PHP class cache.
This methods only registers the fact that you want to load the cache classes. The cache will actually only be loaded when the Kernel is booted.
That optimization is mainly useful when using the HttpCache class in which case the class cache is not loaded if the Response is in the cache.
at line line 334
setClassCache(array $classes)
Used internally.
at line line 342
int
getStartTime()
Gets the request start time (not available if debug is disabled).
at line line 350
string
getCacheDir()
Gets the cache directory.
at line line 358
string
getLogDir()
Gets the log directory.
at line line 366
string
getCharset()
Gets the charset of the application.
at line line 672
static string
stripComments(string $source)
Removes comments from a PHP source string.
We don't use the PHP phpstripwhitespace() function as we want the content to be readable and well-formatted.