Exemple #1
0
 private function prepareContainer($class, $configFiles)
 {
     $tempDir = __DIR__ . '/../temp';
     foreach (Finder::findFiles('*')->exclude('.gitignore')->from($tempDir . '/cache') as $file) {
         unlink((string) $file);
     }
     $configurator = new \Nette\Config\Configurator();
     $configurator->setTempDirectory($tempDir);
     foreach ($configFiles as $file) {
         $configurator->addConfig($file, FALSE);
     }
     $configurator->addParameters(array('fixturesDir' => __DIR__ . '/../fixtures', 'tempDir' => $tempDir, 'container' => array('class' => $class)));
     $extension = new \WebLoader\Nette\Extension();
     $extension->install($configurator);
     $this->container = $configurator->createContainer();
 }
Exemple #2
0
// Load Nette Framework or autoloader generated by Composer
require __DIR__ . '/../vendor/autoload.php';
// Base dirs
$logDir = __DIR__ . "/../log";
$tempDir = __DIR__ . "/../temp";
// Deployment center
$deploy = new DeployCenter\Application($logDir, $tempDir, "123");
# modify password!
$deploy->register("debug")->checkMaintenance();
// Create Nette Configurator
$configurator = new \Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
//$configurator->setDebugMode(TRUE);
if (PHP_SAPI === "cli") {
    $configurator->setDebugMode(TRUE);
    $configurator->addParameters(array("environment" => $configurator::DEVELOPMENT));
}
$configurator->enableDebugger($logDir);
// Specify folder for cache
$configurator->setTempDirectory($tempDir);
// Enable RobotLoader - this will load all classes automatically
$configurator->createRobotLoader()->addDirectory(__DIR__)->addDirectory(__DIR__ . '/../vendor/others')->addDirectory($tempDir . "/proxies")->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon', $configurator::NONE);
// ModulesInstaller
$modulesInstaller = new \Flame\Modules\ModulesInstaller(new \Flame\Modules\DI\ConfiguratorHelper($configurator));
$modulesInstaller->addConfig(new \Flame\Modules\Config\NeonConfigFile(__DIR__ . "/config/config.neon", $tempDir . "/cache"));
$modulesInstaller->register();
return $configurator->createContainer();
Exemple #3
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;
//$application->catchExceptions = TRUE;
 * My Application bootstrap file.
 */
use Nette\Application\Routers\Route;
// Load Nette Framework
define('VENDORS_DIR', __DIR__ . '/../vendor');
require_once VENDORS_DIR . '/nette/nette/Nette/loader.php';
require_once VENDORS_DIR . '/autoload.php';
// Configure application
$configurator = new Nette\Config\Configurator();
// Enable Nette Debugger for error visualisation & logging
//$configurator->setProductionMode($configurator::AUTO);
$configurator->enableDebugger(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(APP_DIR)->addDirectory(LIBS_DIR)->register();
$configurator->addParameters(array('libsDir' => LIBS_DIR));
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->onCompile[] = function ($configurator, $compiler) {
    $compiler->addExtension('documentManagerExtension', new \Extensions\DocumentManagerExtension());
    $compiler->addExtension('appCommands', new \Extensions\AppCommandsExtension());
    $compiler->addExtension('doctrineODMCommands', new \Extensions\DoctrineODMCommandsExtension());
    $compiler->addExtension('consoleApp', new \Extensions\ConsoleExtension());
};
$container = $configurator->createContainer();
if (PHP_SAPI === 'cli') {
    $container->console->run();
} else {
    // Setup router
    $container->router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
    $container->router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
Exemple #5
0
<?php

/**
 * My Application bootstrap file.
 */
use Nette\Application\Routers\Route;
// Step 1: Load Nette Framework
// this allows load Nette Framework classes automatically so that
// you don't have to litter your code with 'require' statements
require LIBS_DIR . '/Nette/nette.min.php';
// Step 2: Configure application
$configurator = new Nette\Config\Configurator();
// 2a) Enable Nette Debugger for error visualisation & logging
$configurator->enableDebugger(__DIR__ . '/../log');
// 2b) Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()->addDirectory(APP_DIR)->addDirectory(LIBS_DIR)->register();
// 2c) Set baseUri for use in config.neon
$baseUri = dirname($_SERVER['SCRIPT_NAME']);
$configurator->addParameters(array('baseUri' => $baseUri));
// 2d) Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config/config.neon');
// Step 3: Create DI container
$container = $configurator->createContainer();
// Step 4: Setup application router
$container->router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY);
$container->router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
// Step 5: Run the application!
$container->application->run();