public function compile(ImportEvent $event) { $plugins = []; $basedir = realpath(sprintf('%s/../../../..', __DIR__)); $results = $this->cache->get('plugin-list', function () { return $this->client->getPackages(); }, 300); foreach ($results ?? [] as $package) { $plugin = $package['name']; if ($plugin !== 'minutephp/minutephp' && $plugin !== 'minutephp/framework') { $name = join(' ', array_slice(preg_split('/\\W+/', $plugin), 1)); $vendor = dirname($plugin); $official = $vendor === 'minutephp'; $type = $official ? 'official' : 'thirdparty'; $required = ['admin', 'framework']; $plugins[$type][] = ['plugin' => $plugin, 'name' => $name, 'description' => $package['description'], 'installed' => is_dir("{$basedir}/{$plugin}"), 'required' => $official && in_array($name, $required), 'src' => $package['src']]; } } $event->setContent($plugins); }