Example #1
0
 private static function loadService($service)
 {
     try {
         $servicePath = SERVICES_PATH . '/' . $service . '/';
         Bootstrap::load($servicePath . 'interface.php');
         $implementationsPath = $servicePath . '/' . IMPLEMENTATIONS_DIR . '/';
         $directory = new DirectoryIterator($implementationsPath);
         foreach ($directory as $fileInfo) {
             if ($fileInfo->isFile()) {
                 //					self::$Logger->debug('Loading service "' . $fileInfo->getFilename() . '"...');
                 Bootstrap::load($implementationsPath . $fileInfo->getFilename());
             }
         }
     } catch (Exception $e) {
         self::$Logger->error('Cannot load service "' . $service . '"');
         if (self::$Logger->isDebugEnabled()) {
             self::$Logger->debug(ExceptionStackUtil::getStackTrace($e, false));
         }
         throw new EyeBootstrapException('Cannot load service "' . $service . '".', 0, $e);
     }
 }
 * then we can do that logic over here and before toching the application itself we know the infomations
 * for translation, location wise redirect etc.
 * 
 * Here we are declaring an applicaiton constant so that our application know which environment is
 * currently active. This is used in config file as well
 */
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH), realpath(APPLICATION_PATH . '/../library'), get_include_path())));
/**
 * Include auto loader
 */
include_once 'Noobh/Loader/Autoloader.php';
/**
 * The following code can be added in application Bootstrap or t
 * index.php file where document root exist. By default all library
 * classes under Noobh will be autoloaded.
 */
$autoloader = Noobh_Loader_Autoloader::getInstance();
//$globalConfigs = array(GLOBAL_RESOURCE_PATH. '/conf/conf.php');
$config = Noobh_Config::getInstance(realpath(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'application.ini'));
Noobh_Registry::set('config', $config);
/**
 * The following code can be added in application Bootstrap or
 * index.php file where document root exist. By default all library
 * classes under ISTWeb will be autoloaded.
 */
require_once realpath(APPLICATION_PATH) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
$bootstrap = new Bootstrap($config);
$bootstrap->load();
Example #3
0
$options['config'] = array_key_exists('config', $opts) ? $opts['config'] : (array_key_exists('c', $opts) ? $opts['c'] : ROOT_PATH . '/app/etc/db.php');
$options['migration'] = array_key_exists('migration', $opts) ? $opts['migration'] : (array_key_exists('m', $opts) ? $opts['m'] : './migrations');
$options['bootstrap'] = array_key_exists('bootstrap', $opts) ? $opts['bootstrap'] : (array_key_exists('b', $opts) ? $opts['b'] : ROOT_PATH . '/app/bootstrap.php');
foreach ($options as $k => $v) {
    if (empty($v)) {
        die('fatal error: "' . $k . '" option must not be empty, please provide a valid value or let the default one');
    }
}
$environments = array('development', 'production', 'testing', 'staging');
foreach ($environments as $e) {
    if (preg_match('/^' . $options['environment'] . '/', $e)) {
        $options['environment'] = $e;
        break;
    }
}
define('ENV', $options['environment']);
ini_set('display_errors', true);
error_reporting(-1);
date_default_timezone_set('Europe/Paris');
//define('LIB_PATH',  ROOT_PATH . '/lib');
define('VENDOR_PATH', ROOT_PATH . '/vendor');
set_include_path(PATH_SEPARATOR . VENDOR_PATH);
// set up autoloader
//spl_autoload_register(function ($class) { include str_replace('\\', '/', $class) . '.php'; });
// include_once ROOT_PATH . '/app/autoload_register.php';
@(include_once __DIR__ . '/../vendor/autoload.php') || @(include_once __DIR__ . '/../../../autoload.php');
include_once $options['bootstrap'];
$bootstrap = new Bootstrap(array('options' => $options, 'argv' => $argv));
$resources = $bootstrap->load();
$application = new \Incube\Event\Application('shootmania_admin', $resources['event_manager']);
$application->set_resources($resources)->start();