private function loadConfiguration() { $config = $this->parseConfiguration(); if (array_key_exists('autoload', $config)) { $this->container->getService('class_loader')->addPrefixes($config['autoload']); } if (array_key_exists('parameters', $config)) { if (!is_array($config['parameters'])) { throw new \RuntimeException("Parameters key in config.yml must be a valid array."); } foreach ($config['parameters'] as $id => $value) { $this->container->setParameter($id, $value); } } if (array_key_exists('extensions', $config)) { foreach ($config['extensions'] as $extensionClass => $constructorArguments) { $arguments = $this->getExtensionArgumentsValues($constructorArguments); $extension = $this->container->getService('extension.initializer')->initialize($extensionClass, $arguments); $extension->load($this->container); } } }
<?php use Coduo\TuTu\Kernel; use Coduo\TuTu\ServiceContainer; use Symfony\Component\HttpFoundation\Request; if (is_file($autoload = __DIR__ . '/../../vendor/autoload.php')) { require $autoload; } else { header("Content-Type:text/plain"); die('You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL); } $container = new ServiceContainer(); $container->setParameter('tutu.root_path', realpath(__DIR__ . '/..')); $kernel = new Kernel($container); $request = Request::createFromGlobals(); $kernel->handle($request)->send();