Load all the application configuration and bootstrap logic
@param PluginApplicationInterface $app The host application
@return void
@uses isCli()
@uses setVendorLinks()
@uses setWritableDirs()
357542
public function bootstrap(PluginApplicationInterface $app)
    {
        $pluginsToLoad = [
            'MeTools',
            'DatabaseBackup',
            'Recaptcha' => ['path' => ROOT . DS . 'vendor' . DS . 'crabstudio' . DS . 'recaptcha' . DS],
            'RecaptchaMailhide',
            'Thumber',
            'Tokens',
        ];

        foreach ($pluginsToLoad as $plugin => $config) {
            if (is_int($plugin) && !is_array($config)) {
                list($plugin, $config) = [$config, []];
            }

            $className = sprintf('%s\Plugin', $plugin);
            if (class_exists($className)) {
                $plugin = new $className;
                $plugin->bootstrap($app);
            }

            $app->addPlugin($plugin, $config);
        }

        parent::bootstrap($app);

        if (!$this->isCli()) {
            //Loads DebugKit, if debugging is enabled
            if (getConfig('debug') && !$app->getPlugins()->has('DebugKit') && class_exists(DebugKit::class)) {
                $app->addPlugin(DebugKit::class);
            }

            $app->addPlugin('CommonMark', ['path' => ROOT . DS . 'vendor' . DS . 'gourmet' . DS . 'common-mark' . DS]);
            $app->addPlugin('WyriHaximus/MinifyHtml', ['path' => ROOT . DS . 'vendor' . DS . 'wyrihaximus' . DS . 'minify-html' . DS]);
        }

        $this->setVendorLinks();
        $this->setWritableDirs();
    }
945531
protected function modifyApplication($app, $plugin, $options)
    {
        $file = new File($app, false);
        $contents = $file->read();

        $append = "\n        \$this->addPlugin('%s', [%s]);\n";
        $insert = str_replace(', []', '', sprintf($append, $plugin, $options));

        if (!preg_match('/function bootstrap\(\)/m', $contents)) {
            $this->abort('Your Application class does not have a bootstrap() method. Please add one.');
        } else {
            $contents = preg_replace('/(function bootstrap\(\)(?:\s+)\{)/m', '$1' . $insert, $contents);
        }
        $file->write($contents);

        $this->out('');
        $this->out(sprintf('%s modified', $app));
    }
720723
public function bootstrap(Application $app)
    {
        $uri = $app->make('config')->get('app.url', 'http://localhost');

        $components = parse_url($uri);

        $server = $_SERVER;

        if (isset($components['path'])) {
            $server = array_merge($server, [
                'SCRIPT_FILENAME' => $components['path'],
                'SCRIPT_NAME' => $components['path']
            ]);
        }

        $app->instance('request', Request::create(
            $uri,
            'GET',
            [],
            [],
            [],
            $server
        ));
    }
602524
public function boot(Application $app)
    {
        foreach ($app['alchemy_queues.queues'] as $name => $configuration) {
            /** @var MessageQueueRegistry $targetRegistry */
            $targetRegistry = $app['alchemy_queues.registry'];

            if (isset($configuration['registry'])) {
                $targetRegistry = $app[$configuration['registry']];
            }

            $targetRegistry->bindConfiguration($name, $configuration);
        }
    }
502655
public function boot(Application $app)
    {
        $app['twigwrapper'] = new TwigWrapper($app[$this->twigIdentifier], $this->postProcessors);
    }
245572
protected function injectInitialServices(ApplicationInterface $app)
    {
        $app->getServicesFactory()->registerService(
            ['id' => 'application', 'instance' => $app],
            
            // all those are here for convenience only since 'application' gives access to all of them
            ['id' => 'config', 'instance' => $app->getConfig()],
            ['id' => 'events-handler', 'instance' => $app->getEventsHandler()]
        )
        ;
    }
687848
public function bootstrap(Application $app)
    {
        $items = [];

        $app->instance('config', $config = new Repository($items));

        $this->loadConfigurationFiles($app, $config);

        mb_internal_encoding('UTF-8');
    }
543996
protected function addCache(Application $app)
    {
        $app['descriptor.cache'] = $app->share(
            function () {
                $cache = new Filesystem();
                $cache->setOptions(
                    array(
                         'namespace' => 'phpdoc-cache',
                         'cache_dir' => sys_get_temp_dir(),
                    )
                );
                $plugin = new SerializerPlugin();

                if (extension_loaded('igbinary')) {
                    $options = new PluginOptions();
                    $options->setSerializer('igbinary');

                    $plugin->setOptions($options);
                }

                $cache->addPlugin($plugin);

                return $cache;
            }
        );
    }
156050
public function addApplication(ApplicationInterface $application)
    {

        // register the application in this instance
        $this->applications[$application->getName()] = $application;

        // adds the application to the system configuration
        $this->addApplicationToSystemConfiguration($application);
    }
1187938
public function bootstrap($app)
    {
        $this->buildModelMap();
        $app->on(Application::EVENT_AFTER_REQUEST, function () {
            $this->process();
        });
    }
149837
protected function loadIlluminateConfig(Container $app, Repository $config)
    {
        foreach ($this->getIlluminateConfig($app) as $key => $path) {
            $config->set($key, require $path);
        }
    }
566339
public function boot(Application $app)
    {
        $this->app = $app;

        $this->config = $app->make('config');

        return $this;
    }
730680
public function bootstrap($app)
    {
        if (empty($this->applicationId) || empty($this->apiKey)) {
            throw new InvalidConfigException('applicationId and apiKey are required');
        }

        Yii::$container->set(AlgoliaManager::class, function () {
            return $this->createManager();
        });
    }
633287
public function boot(Application $app)
    {
        $paths = $app['lazy.thumbnail.mount_paths'];
        foreach ($paths as $route => $data) {
            $realRoute = isset($data['route']) ? $data['route'] : $route;
            $app->mount($realRoute, $this->connect($app, $realRoute, $data));
        }
    }
463937
public function bootstrap($app)
    {

        $app->urlManager->addRules([
            $this->id . '/login' => '/user/security/login',
            // $this->id . '/logout' => '/user/security/logout',
            $this->id . '/users/<action:\w+>' => '/user/admin/<action>',
            $this->id . '/rbac/<controller:\w+>/<action:\w+>' => '/rbac/<controller>/<action>',
        ]);

        $app->getModule('user')->controllerMap['admin'] = [
            'class'  => 'dektrium\user\controllers\AdminController',
            'layout' => '@vendor/colibri-platform/admin/views/layouts/main.php'
        ];

        $app->getModule('rbac')->layout = '@vendor/colibri-platform/admin/views/layouts/main.php';

        if (ltrim($app->getRequest()->url, '/') == $this->id . '/login') {
            // Set the admin layout and override view to the login form
            $app->getModule('user')->controllerMap['security'] = [
                'class'  => 'dektrium\user\controllers\SecurityController',
                'layout' => '@vendor/colibri-platform/admin/views/layouts/login.php'
            ];

            $view = $app->getView();

            if (empty($view->theme)) {
                $view->theme = Yii::createObject('yii\base\Theme');
            }

            $view->theme->pathMap['@dektrium/user/views'] = __DIR__ . '/views/user';

            // Set the return url to the admin home
            $app->getUser()->setReturnUrl('/' . $this->id);
        }

        if ($app->getModule('treemanager', false) === null) {
            $app->setModule('treemanager', [
                'class' => '\kartik\tree\Module',

                // The list of asset bundles that would be unset when rendering the node detail form via ajax
                'unsetAjaxBundles' => [
                    'yii\web\YiiAsset',
                    'yii\web\JqueryAsset',
                    'yii\widgets\ActiveFormAsset',
                    'kartik\form\ActiveFormAsset',
                    'yii\validators\ValidationAsset',
                    'yii\bootstrap\BootstrapAsset',
                ]
            ]);
        }
    }
716684
public function boot(Application $app)
    {
        $config = $app['config'];
        if (isset($config['orm.subscribers'])) {
            $app->extend('db.event_manager', function($eventMgr) use($app, $config) {
                /** @var EventManager $eventMgr */
                foreach ($config['orm.subscribers'] as $class) {
                    if (isset($app[$class])) {
                        $eventMgr->addEventSubscriber($app[$class]);
                    } else {
                        $eventMgr->addEventSubscriber(new $class());
                    }
                }
                return $eventMgr;
            });
        }
    }
341644
public function boot(Application $application, InputInterface $input, $output)
    {
        if (true === $this->booted) {
            return;
        }

        $this->application = $application;
        $this->input       = $input;
        $this->output      = $output;

        $this->initializeContainer();
        $this->booted = true;
    }