Exemple #1
0
/**
 * My Application bootstrap file.
 */
use Nette\Diagnostics\Debugger, Nette\Application\Routers\Route;
// Load Nette Framework
require LIBS_DIR . '/Nette/loader.php';
// Enable Nette Debugger for error visualisation & logging
Debugger::$logDirectory = __DIR__ . '/../log';
Debugger::$strictMode = TRUE;
Debugger::enable();
// Configure application
$parameters = array();
$parameters['tempDir'] = __DIR__ . '/../temp';
$parameters['cacheDir'] = __DIR__ . '/../temp/cache';
$configurator = new Nette\Config\Configurator();
$configurator->setCacheDirectory($parameters['cacheDir']);
$configurator->addParameters($parameters);
// Enable RobotLoader - this will load all classes automatically
$configurator->createRobotLoader()->addDirectory(APP_DIR)->addDirectory(LIBS_DIR)->register();
// Create Dependency Injection container from config.neon file
$container = $configurator->loadConfig(__DIR__ . '/config/config.neon');
// Opens already started session
if ($container->session->exists()) {
    $container->session->start();
}
// Setup router
$router = $container->router;
$router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
// Configure and run the application!
$application = $container->application;