app->set( PluginRepositoryInterface::class, PluginRepository::class, ); $this->loadPlugins(); $this->loadTheme(); } public function loadPlugins() { $finder = new PluginFinder(); $plugins = $finder->findPlugins($this->pluginsDir); /** @var PluginLoader */ $loader = $this->container->get(PluginLoader::class); foreach ($plugins as $plugin) { try { $loader->load($plugin); } catch (Throwable $th) { if ($this->enableDebugging) { throw $th; } // Production environment. Skip plugin. } } } public function loadTheme() { $this->twig->addExtension($this->themeExtension); if (file_exists($this->pluginsDir . '/' . $this->theme)) { $this->loader->addPath( $this->pluginsDir . '/' . $this->theme, 'theme' ); } } }