Example #1
0
<?php

$config_path = BASE . 'app/config/parameters.ini';
$parameters = parse_ini_file($config_path);
$app = Application\App::getInstance();
foreach ($parameters as $key => $value) {
    $app->set($key, $value);
}
Example #2
0
<?php

if (getenv('APPLICATION_ENV') == 'development') {
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', true);
    ini_set('html_errors', true);
}
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(__DIR__) . '/../lib' . DIRECTORY_SEPARATOR);
define('APP_PATH', realpath(__DIR__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'app');
require 'Application/App.php';
$config = array('controllersPath' => APP_PATH . DIRECTORY_SEPARATOR . 'controllers', 'viewsPath' => APP_PATH . DIRECTORY_SEPARATOR . 'views', 'database' => array('dsn' => 'mysql:dbname=xmldata;host=localhost', 'user' => 'xmldatauser', 'pass' => 'xmlD@t4us£r', 'options' => array()));
$app = new Application\App($config);
$app->run();
Example #3
0
<?php

// Require definitions
require_once '../config/definitions.php';
// Require composite libraries
require_once DOCUMENT_ROOT . '../vendor/autoload.php';
// Require global configurations
require_once DOCUMENT_ROOT . '../config/' . APPLICATION_ENV . '.php';
// init application
$app = new Application\App($config);
try {
    // start application
    return $app->execute();
} catch (\Exception $e) {
    $message = ['error' => ['code' => $e->getCode(), 'message' => $e->getMessage()]];
    // log message
    $errorLog = $app->getAppLogger();
    $errorLog->json($message)->getLogger()->error($e->getMessage());
    //(APPLICATION_ENV != 'production') ? $errorLog->json($message) : $errorLog->getLogger()->error($e->getMessage());
}