Beispiel #1
0
<?php

/**
 *
 * Bootstrap file for universal load.
 *
 * This file will be load by cli and web entry, you can define or config the application as global use.
 *
 */
use Pagon\App;
define('APP_DIR', __DIR__);
require __DIR__ . '/vendor/autoload.php';
$app = new App(__DIR__ . '/config/default.php');
// Load env from file
if (is_file(__DIR__ . '/config/env')) {
    $app->mode(trim(file_get_contents(__DIR__ . '/config/env')));
}
$mode = $app->mode();
if (is_file($conf_file = __DIR__ . '/config/' . $mode . '.php')) {
    $app->append(include $conf_file);
}
// Boost application
$app->add('Booster');
// Functions
$app->assisting();
// Add pretty exception
if ($app->debug) {
    $app->add('PrettyException');
} else {
    error_reporting(E_ALL & ~E_NOTICE);
}
Beispiel #2
0
<?php

use Pagon\App;
define('APP_DIR', __DIR__);
define('BASE_DIR', dirname(__DIR__));
require dirname(__DIR__) . '/vendor/autoload.php';
$app = new App(array('views' => APP_DIR . '/views', 'autoload' => APP_DIR . '/src') + (include BASE_DIR . '/config/default.php'));
/**
 * Config
 */
// Load env from file
if (is_file(BASE_DIR . '/config/env')) {
    $app->mode(trim(file_get_contents(BASE_DIR . '/config/env')));
}
// Load config by enviroment
if (!is_file($conf_file = BASE_DIR . '/config/' . $app->mode() . '.php')) {
    echo "No config found! Plz add config/" . $app->mode() . ".php file";
    exit;
} else {
    $app->append(include $conf_file);
}
$app->add('Booster');
$app->assisting();
// Add pretty exception
if ($app->debug) {
    $app->add('PrettyException');
} else {
    error_reporting(E_ALL & ~E_NOTICE);
}
$app->protect('loadOrm', function () {
    global $app;