/** * Create the container * * @todo Move this to a ContainerFactory * * @return \Joomla\DI\Container */ function initContainer() { $container = new \Joomla\DI\Container(); $container->set('ConfigDirectory', __DIR__); (new IniLoader($container))->loadFromFile(__DIR__ . '/config/services.ini'); if (!defined('JPATH_ROOT')) { define('JPATH_ROOT', $container->get('config')->get('JPATH_ROOT', __DIR__)); } return $container; }
<?php /** * @version 1.0.0 * @package com_framework * @copyright Copyright (C) 2014. All rights reserved. * @license MIT */ // no direct access defined('_JEXEC') or die; const COMPONENT_ROOT = __DIR__; JLoader::registerNamespace('Framework', __DIR__ . '/src'); $app = JFactory::getApplication(); // Set the default view $app->input->def('view', 'list'); $container = new Joomla\DI\Container(); $container->set('JApplicationCms', $app); $container->set('JInput', $app->input); $container->set('JDatabaseDriver', JFactory::getDbo()); echo (new Framework\Dispatcher($app, $container))->execute();