getPlugins(); foreach ($plugins as $plugin) { $installed[] = $plugin->getId(); } $page = new PageSetup('menu.plugin'); $page->setHelp('plugins.html'); $all = $this->getPluginInformation($client, $cache); $bundles = []; foreach ($all as $item) { if ($item['bundle'] !== null) { $bundles[$item['bundle']] = $item; } } return $this->render('plugin/index.html.twig', [ 'page_setup' => $page, 'plugins' => $plugins, 'installed' => $installed, 'extensions' => $all, 'bundles' => $bundles, ]); } private function getPluginInformation(HttpClientInterface $client, CacheInterface $cache): array { return $cache->get('kimai.marketplace_extensions', function (ItemInterface $item) use ($client) { try { $response = $client->request('GET', 'https://www.kimai.org/plugins.json'); if ($response->getStatusCode() !== 200) { return []; } $json = json_decode($response->getContent(), true); if ($json === null) { return []; } $item->expiresAfter(86400); // one day return $response->toArray(); } catch (\Throwable $exception) { $this->logException($exception); $this->flashError('Could not download plugin information'); } return []; }); } }