Last active
August 29, 2015 14:04
-
-
Save jakzal/3c225a526a292e8668f2 to your computer and use it in GitHub Desktop.
Dump a Symfony Standard Edition DI container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @license MIT | |
*/ | |
$loader = require_once __DIR__.'/bootstrap.php.cache'; | |
require_once __DIR__.'/AppKernel.php'; | |
use Symfony\Component\Config\ConfigCache; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; | |
class DumperKernel extends \AppKernel | |
{ | |
private $containerGraph; | |
protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) | |
{ | |
$dumper = new GraphvizDumper($container); | |
$this->containerGraph = $dumper->dump(['graph' => ['rankdir' => 'RL']]); | |
parent::dumpContainer($cache, $container, $class, $baseClass); | |
} | |
public function dump() | |
{ | |
$this->boot(); | |
return $this->containerGraph; | |
} | |
} | |
$kernel = new DumperKernel('dev', true); | |
echo $kernel->dump(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment