/** * @param $module * * @return bool */ public function bootstrapModule($module) { $config = Config::get('module'); $modulePath = $config['module.path'] . DS; $moduleConfigDir = $config['module.config'] . DS; $class = '\\' . APP_NS . '\\' . $this->getModuleDir() . '\\' . ucfirst($module) . '\\BootStrap'; $file = $modulePath . ucfirst($module) . DS . $moduleConfigDir . strtolower($module) . EXT; if (!file_exists($file)) { return false; } Config::set(strtolower($module) . '.config', include $file); return (new $class())->register($this->getApplication(), $file); }
/** * @return array * @throws \Exception */ private function importConfigurations() { $configPath = ""; $configPath = static::$paths['app.path'] . DS . toPath(static::$paths['app.config']['directory']); $files = []; $files = array_merge($this->files, static::$paths['app.config']['files']); foreach ($files as $key => $file) { if (!file_exists($configPath . $file . EXT)) { throw new \Exception("File doesn't exists in the path " . $configPath . $file . EXT); } /** | We will include configuration file into array only | for the first time */ if (!isset(self::$config[$key])) { Config::set($key, include $configPath . $file . EXT); } } }
/** * Start booting and handler all user request * * @return Dispatcher */ public function boot() { //Set up configurations for your awesome application Config::set('config.items', $this['config']); //Set URL base path. Url::setBase(Config::get('global.config', 'base_path') == '' ? $this['router']->getBaseUrl() : Config::get('global.config', 'base_path')); $this['service.provider'](); //initialize framework $this['boot']->initialize($this); $this['boot']->terminate(); return $this; }
/** * Start booting and handler all user request * @return Dispatcher */ public function boot() { Url::instance($this['router']); //Set up configurations for your awesome application Config::set('config.items', $this['config']); //Set URL base path. Url::setBase(Config::get('global.config', 'base_path') == '' ? $this['router']->getBaseUrl() : Config::get('global.config', 'base_path')); //initialize framework $this['boot']->initialize(); $this['boot']->terminate(); /**------------------------------------------------------- * Booting completed. Lets handle user request!! * Lets Go !! * ------------------------------------------------------- */ return new Dispatcher($this['router']); }