Skip to content
Permalink
Browse files

modern bootstrap

  • Loading branch information...
dg committed Feb 1, 2019
1 parent b42b1fa commit 427d37fe81fed1ea84f5b58e9018d21fc28935e4
@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace App;
use Nette\Application\Routers\Route;
use Nette\Application\Routers\RouteList;
use Nette\Application\Routers\SimpleRouter;
use Nette\Configurator;
class Booting
{
public static function boot(): Configurator
{
$configurator = new Configurator;
// Enable Tracy for error visualisation & logging
//$configurator->setDebugMode('23.75.345.200'); // enable for your remote IP
$configurator->enableTracy(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()
->addDirectory(__DIR__)
->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config.neon');
// Setup router using mod_rewrite detection
if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules(), true)) {
$router = new RouteList;
$router[] = new Route('index.php', 'Dashboard:default', Route::ONE_WAY);
$router[] = new Route('<presenter>/<action>[/<id>]', 'Dashboard:default');
} else {
$router = new SimpleRouter('Dashboard:default');
}
$configurator->addServices(['router' => $router]);
return $configurator;
}
}

This file was deleted.

Oops, something went wrong.
@@ -25,5 +25,8 @@
"latte/latte": "^2.5",
"tracy/tracy": "^2.6"
},
"autoload": {
"classmap": ["app/Booting.php"]
},
"minimum-stability": "dev"
}
@@ -2,9 +2,11 @@
declare(strict_types=1);
// let bootstrap create Dependency Injection container
$container = require __DIR__ . '/../app/bootstrap.php';
if (@!include __DIR__ . '/../vendor/autoload.php') {
die('Install Nette using `composer update`');
}
// run application
$container->getByType(Nette\Application\Application::class)
App\Booting::boot()
->createContainer()
->getByType(Nette\Application\Application::class)
->run();
@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace App;
use Nette\Application\Routers\SimpleRouter;
use Nette\Configurator;
class Booting
{
public static function boot(): Configurator
{
$configurator = new Configurator;
// Enable Tracy for error visualisation & logging
//$configurator->setDebugMode('23.75.345.200'); // enable for your remote IP
$configurator->enableTracy(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()
->addDirectory(__DIR__)
->register();
// Setup router
$configurator->addServices(['router' => new SimpleRouter('Default:default')]);
return $configurator;
}
}

This file was deleted.

Oops, something went wrong.
@@ -21,5 +21,8 @@
"latte/latte": "^2.5",
"tracy/tracy": "^2.6"
},
"autoload": {
"classmap": ["app/Booting.php"]
},
"minimum-stability": "dev"
}
@@ -2,9 +2,11 @@
declare(strict_types=1);
// let bootstrap create Dependency Injection container
$container = require __DIR__ . '/../app/bootstrap.php';
if (@!include __DIR__ . '/../vendor/autoload.php') {
die('Install Nette using `composer update`');
}
// run application
$container->getByType(Nette\Application\Application::class)
App\Booting::boot()
->createContainer()
->getByType(Nette\Application\Application::class)
->run();
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App;
use Nette\Application\Routers\Route;
use Nette\Application\Routers\RouteList;
use Nette\Application\Routers\SimpleRouter;
use Nette\Configurator;
class Booting
{
public static function boot(): Configurator
{
$configurator = new Configurator;
// Enable Tracy for error visualisation & logging
//$configurator->setDebugMode('23.75.345.200'); // enable for your remote IP
$configurator->enableTracy(__DIR__ . '/../log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()
->addDirectory(__DIR__)
->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(__DIR__ . '/config.neon');
// Setup router using mod_rewrite detection
if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules(), true)) {
$router = new RouteList;
$router[] = new Route('index.php', 'Front:Default:default', Route::ONE_WAY);
$router[] = $adminRouter = new RouteList('Admin');
$adminRouter[] = new Route('admin/<presenter>/<action>', 'Default:default');
$router[] = $frontRouter = new RouteList('Front');
$frontRouter[] = new Route('<presenter>/<action>[/<id>]', 'Default:default');
} else {
$router = new SimpleRouter('Front:Default:default');
}
$configurator->addServices(['router' => $router]);
return $configurator;
}
}

This file was deleted.

Oops, something went wrong.
@@ -21,5 +21,8 @@
"latte/latte": "^2.5",
"tracy/tracy": "^2.6"
},
"autoload": {
"classmap": ["app/Booting.php"]
},
"minimum-stability": "dev"
}
@@ -2,9 +2,11 @@
declare(strict_types=1);
// let bootstrap create Dependency Injection container
$container = require __DIR__ . '/../app/bootstrap.php';
if (@!include __DIR__ . '/../vendor/autoload.php') {
die('Install Nette using `composer update`');
}
// run application
$container->getByType(Nette\Application\Application::class)
App\Booting::boot()
->createContainer()
->getByType(Nette\Application\Application::class)
->run();

0 comments on commit 427d37f

Please sign in to comment.
You can’t perform that action at this time.