web/vendor/nette/bootstrap
2019-02-26 13:03:45 -06:00
..
src Add Composer autoloading functions and PHPStan for testing 2019-02-26 13:03:45 -06:00
composer.json Add Composer autoloading functions and PHPStan for testing 2019-02-26 13:03:45 -06:00
contributing.md Add Composer autoloading functions and PHPStan for testing 2019-02-26 13:03:45 -06:00
license.md Add Composer autoloading functions and PHPStan for testing 2019-02-26 13:03:45 -06:00
readme.md Add Composer autoloading functions and PHPStan for testing 2019-02-26 13:03:45 -06:00

Nette Bootstrap

Downloads this Month Build Status Coverage Status Latest Stable Version License

File bootstrap.php loads Nette Framework and all libraries that we depend on:

require __DIR__ . '/../vendor/autoload.php';

Class Configurator creates so called DI container and handles application initialization.

$configurator = new Nette\Configurator;

Activates Tracy in strict mode:

//$configurator->setDebugMode(true);
$configurator->enableTracy(__DIR__ . '/../log');

Setup directory for temporary files

$configurator->setTempDirectory(__DIR__ . '/../temp');

Activate autoloading, that will automatically load all the files with our classes:

$configurator->createRobotLoader()
	->addDirectory(__DIR__)
	->addDirectory(__DIR__ . '/../vendor/others')
	->register();

And according to the configuration files it generates a DI container. Everything else depends on it.

We will return this DI Container as a result of calling app/boostrap.php

$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon');
return $configurator->createContainer();

and we will store it as local variable in www/index.php and run the application:

$container = require __DIR__ . '/../app/bootstrap.php';
$container->getService('application')->run();

That's it.