Bootstrap method to be called during application bootstrap stage.
@param Application $app the application currently running
183372
public function bootstrap($app)
    {
		$models = Yii::$app->getModule('vote')->models;
		foreach ($models as $value) {
			$modelId = Rating::getModelIdByName($value);
			$modelName = Rating::getModelNameById($modelId);
			Event::on($modelName::className(), $modelName::EVENT_INIT, function ($event) {
			    if (null === $event->sender->getBehavior('rating')) {
					$event->sender->attachBehavior('rating', [
						'class' => RatingBehavior::className(),
					]);
				}
			});
		}
    }
1233109
public function bootstrap(Application $app)
    {
        $app->make('orchestra.memory')->extend('user', function ($app, $name) {
            return new UserProvider(
                new UserRepository($name, [], $app)
            );
        });
    }
200833
protected function resolveApplicationConfiguration($app)
    {
        $app->make('Illuminate\Foundation\Bootstrap\LoadConfiguration')->bootstrap($app);

        \tap($this->getApplicationTimezone($app), function ($timezone) {
            ! \is_null($timezone) && \date_default_timezone_set($timezone);
        });

        $app['config']['app.aliases'] = $this->resolveApplicationAliases($app);
        $app['config']['app.providers'] = $this->resolveApplicationProviders($app);
    }
798662
public function bootstrap($app)
    {
        /** @var Module $module */
        /** @var \yii\db\ActiveRecord $modelName */
        if ($app->hasModule('system') && ($module = $app->getModule('system')) instanceof Module) {
            if ($app instanceof \yii\console\Application) {

            } else if (class_exists('\yuncms\admin\Application') && $app instanceof \yuncms\admin\Application) {

            } elseif ($module instanceof Module) {//前台判断放最后
                $app->urlManager->addRules([
                    'page' => 'system/page/view',
                ]);
                //注册Url管理
                $app->urlManager->addRules([
                    [
                        'class' => 'yuncms\system\components\SlugUrlRule',
                    ]
                ], true);
            }
        }
//        $app->set('settings', [
//            'class' => 'yuncms\system\components\Settings',
//        ]);

        /**
         * 注册语言包
         */
        if (!isset($app->get('i18n')->translations['system*'])) {
            $app->get('i18n')->translations['system*'] = [
                'class' => PhpMessageSource::className(),
                'sourceLanguage' => 'en-US',
                'basePath' => __DIR__ . '/messages',
            ];
        }
    }
1303205
public function boot(Application $app)
    {
        $app->on(KernelEvents::EXCEPTION, function (GetResponseForExceptionEvent $event) {
            $e = $event->getException();
            if ($e instanceof MethodNotAllowedHttpException && $e->getHeaders()["Allow"] === "OPTIONS") {
                $event->setException(new NotFoundHttpException("No route found for \"{$event->getRequest()->getMethod()} {$event->getRequest()->getPathInfo()}\""));
            }
        });
    }
84157
public function bootstrap(Application $app)
    {
        /** @var Container $container */
        $container = $app->getContainer();

        $container->share('app', $app);
        $container->alias('app', Application::class);
        $container->alias('app', ApplicationInterface::class);

        $container->share('container', $container);

        $container->share('kernel.http', function () use ($container) {
            return $container->get(Kernel::class);
        });
        $container->alias('kernel.http', KernelInterface::class);

        $container->alias('router', Router::class);
        $container->alias('dispatcher', Dispatcher::class);
    }
1147240
public function bootstrap(Application $app)
    {
        try
        {
            Dotenv::makeMutable();
            Dotenv::load($app->environmentPath(), $app->environmentFile());
            Dotenv::makeImmutable();
        } catch (InvalidArgumentException $e)
        {
            //
        }

        $app->detectEnvironment(
            function ()
            {
                return env('APP_ENV', 'production');
            }
        );
    }
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;
            });
        }
    }
342547
public function bootstrap(Container $app)
    {
        foreach ($app->make('config')->get('app.providers') as $provider) {
            $app->register(new $provider($app));
        }
        
        foreach ($app->make('config')->get('app.theme.providers', []) as $provider) {
            $app->register(new $provider($app));
        }
    }
961811
protected function bootstrap(): void
	{
		(function($app, $container): void
		{
			include $this->applicationPath . '/bootstrap.php';
		})($this, $this->container);
	}
783894
public function boot(Application $app)
    {
        $this->strategies = $app['cors.strategies'];
        foreach ($this->strategies as &$strategy) {
            if (is_array($strategy)) {
                $strategy = new CrossOriginResourceSharingStrategy($strategy);
            }
            elseif (!$strategy instanceof CrossOriginResourceSharingStrategy) {
                throw new \InvalidArgumentException(
                    static::class . " must be constructed with array of " . CrossOriginResourceSharingStrategy::class
                );
            }
        }
        
        $app->before([$this, 'onPreRouting'], SilexKernel::BEFORE_PRIORITY_ROUTING + 1);
        $app->before([$this, 'onPostRouting'], SilexKernel::BEFORE_PRIORITY_CORS_PREFLIGHT);
        $app->after([$this, 'onResponse'], Application::LATE_EVENT);
        //$app->error([$this, 'onMethodNotAllowed'], Application::EARLY_EVENT);
        $app->error([$this, 'onMethodNotAllowedHttp'], Application::EARLY_EVENT);
    }
234981
public function bootstrap(Application $app)
	{
		try
		{
			Dotenv::load($app->basePath(), $app->environmentFile());
		}
		catch (InvalidArgumentException $e)
		{
			//
		}

		$app->detectEnvironment(function()
		{
			return env('APP_ENV', 'production');
		});
	}
1255963
public function boot(Application $app, ConfigContract &$appConfig)
    {
        // Setup test DB
        $appConfig->set('database.connections.' . $this->connection, $this->options);
        $appConfig->set('database.default', $this->connection);

        // Set database migration path EG: /mysite/database/
        $app->useDatabasePath($this->path);
    }
875230
public function bootstrap($app)
    {
        $app->registerMigrationAlias('@canis/broadcaster/migrations');
        
        $app->setModule('broadcaster', ['class' => Module::className()]);
        $module = $app->getModule('broadcaster');
        $module->registerHandlers($this->initialHandlers);
        $module->registerEventTypes($this->initialEventTypes);

        Event::on(Daemon::className(), Daemon::EVENT_REGISTER_DAEMONS, [$this, 'registerDaemon']);
        
        // Event::on(Cron::className(), Cron::EVENT_WEEKLY, [$module, 'weeklyEmailDigest']);
        // Event::on(Cron::className(), Cron::EVENT_MORNING, [$module, 'dailyEmailDigest']);
    }
809788
public function boot(Application $app, array $addons)
    {
        foreach ($addons as $addon) {
            $this->registerPackage($app, $addon);
        }
    }
434432
protected function bootstrap()
    {
        $this->app->bootstrap();

        if ($this->app instanceof PluginApplicationInterface) {
            $this->app->pluginBootstrap();
        }
    }
466338
public function bootstrap($app)
    {
        if ($app instanceof WebApplication) {
            $this->addUrlManagerRules($app);
            $this->setPodiumLogTarget($app);
        } elseif ($app instanceof ConsoleApplication) {
            $this->controllerNamespace = 'bizley\podium\console';
        }
    }