Example #1
0
/**
 * 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;
}
Example #2
0
<?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();
Example #3
0
<?php

/**
 * @copyright  Copyright (C) 2012 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
// Define required paths
define('JPATH_ROOT', dirname(__DIR__));
define('JPATH_CONFIGURATION', JPATH_ROOT . '/App/Config');
define('JPATH_SETUP', JPATH_ROOT . '/App/Setup');
define('JPATH_TEMPLATES', JPATH_ROOT . '/App/Templates');
// Load the Composer autoloader
require JPATH_ROOT . '/vendor/autoload.php';
$container = new \Joomla\DI\Container();
$container->registerServiceProvider(new \App\Service\ConfigServiceProvider(JPATH_CONFIGURATION . '/config.json'))->registerServiceProvider(new \App\Service\DatabaseServiceProvider());
// Instantiate the application.
$application = new \App\App($container);
// Execute the application.
$application->execute();