/** * Init application * * @throws BaseException * @throws DependencyInjection\Exception */ protected function init() { $error = new ErrorHandler(); $error->setHandler(new JsonHandler())->setDebug(true)->register(); DotEnv::load(ROOT_DIR); if (!getenv('RAD_ENVIRONMENT')) { putenv('RAD_ENVIRONMENT=production'); } $this->container = Container::getInstance(); Config::set('environment', getenv('RAD_ENVIRONMENT')); Config::set('debug', (bool) getenv('RAD_DEBUG')); Bundles::loadAll($this->registerBundles()); $this->container->setShared('event_manager', new EventManager(), true); $this->loadConfig(); $this->loadService(); $this->loadServicesFromConfig(); $this->container->setShared('router', new Router()); $this->bundleStartup(); }