What samanime recommends works if you need to whole kernel.
If you are just interested in some values the kernel contains, it might be sufficient to just use the parameters set by symfony.
Here is a list of available ones:
Array
(
[0] => kernel.root_dir
[1] => kernel.environment
[2] => kernel.debug
[3] => kernel.name
[4] => kernel.cache_dir
[5] => kernel.logs_dir
[6] => kernel.bundles
[7] => kernel.charset
[8] => kernel.container_class
[9] => kernel.secret
[10] => kernel.http_method_override
[11] => kernel.trusted_hosts
[12] => kernel.trusted_proxies
[13] => kernel.default_locale
)
For instance, the kernel.bundles
contains a list of all registered bundles in the format [bundle => class]
.
PS: I fetched this list using the following compiler pass:
<?php
namespace Acme\InfoBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class InfoCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
print_r(array_values(array_filter(
array_keys($container->getParameterBag()->all()),
function ($e) {
return strpos($e, 'kernel') === 0;
}
)));
die;
}
}