Beispiel #1
0
<?php

// paths
define('PATH_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('PATH_APP', PATH_ROOT . 'app' . DIRECTORY_SEPARATOR);
define('PATH_COM', PATH_APP . 'com' . DIRECTORY_SEPARATOR);
define('PATH_CONF', PATH_COM . 'conf' . DIRECTORY_SEPARATOR);
define('PATH_LIB', PATH_APP . 'lib' . DIRECTORY_SEPARATOR);
define('PATH_MODULE', PATH_APP . 'mod' . DIRECTORY_SEPARATOR);
define('PATH_TEMPLATE', PATH_APP . 'tpl' . DIRECTORY_SEPARATOR);
define('PATH_TEMPLATE_GLOBAL', PATH_TEMPLATE . '_global' . DIRECTORY_SEPARATOR);
define('PATH_VENDOR', PATH_APP . 'vendor' . DIRECTORY_SEPARATOR);
// load Eco
require_once PATH_VENDOR . 'Eco/System.php';
// application bootstrap
require_once PATH_COM . 'app.bootstrap.php';
try {
    // run application
    eco::run();
} catch (Exception $ex) {
    // handle application exception
    eco::error('Exception occurred: ' . $ex->getMessage());
}
Beispiel #2
0
<?php

/**
 * Application bootstrap
 */
// set Eco access class
class eco extends \Eco\System
{
}
// class autoloading
eco::autoload([PATH_LIB, PATH_VENDOR]);
// load configuration settings
eco::conf(PATH_CONF . 'eco.conf.php');
// load helper functions (optional)
require_once PATH_VENDOR . 'Eco/helper/eco.php';
require_once PATH_VENDOR . 'Eco/helper/alias.php';
require_once PATH_VENDOR . 'Eco/helper/factory.php';
require_once PATH_VENDOR . 'Eco/helper/flash.php';
require_once PATH_VENDOR . 'Eco/helper/redirect.php';
require_once PATH_VENDOR . 'Eco/helper/request.php';
require_once PATH_VENDOR . 'Eco/helper/view.php';
// set routes
eco::route(['/' => 'IndexController->home', eco::ERROR_FORBIDDEN => 'ErrorController->error403', eco::ERROR_NOT_FOUND => 'ErrorController->error404', eco::ERROR_SERVER => 'ErrorController->error500']);
// set hook to display log
eco::hook(eco::HOOK_AFTER, function () {
    // echo '<pre>' . print_r(eco::log()->get(), true) . '</pre>';
});