/** * Register an autoloader for application classes. * * @param Container $container */ public function register(Container $container) { $configuration = $container->resolve('Darya\\Foundation\\Configuration'); $basePath = $container->get('path'); $namespace = $configuration->get('project.namespace', 'Application'); // Map the configured namespace to the application directory $autoloader = new Autoloader($basePath, array($namespace => 'application')); $autoloader->register(); $container->register(array('Darya\\Common\\Autoloader' => $autoloader)); }
/** * Register a Smarty view resolver with the service container. * * @param Container $container */ public function register(Container $container) { $container->register(array('Darya\\Smarty\\ViewResolver' => function ($container) { $basePath = $container->get('path'); $realBasePath = realpath("{$basePath}/views/smarty"); $viewResolver = new ViewResolver('Darya\\Smarty\\View', $realBasePath); $viewResolver->shareConfig(array('base' => $realBasePath, 'cache' => '../../storage/cache', 'compile' => '../../storage/views')); $viewResolver->share(array('config' => $container->config)); return $viewResolver; }, 'Darya\\View\\Resolver' => 'Darya\\Smarty\\ViewResolver')); }