public static function getPackages($username) { $packagistClient = new \Packagist\Api\Client(); //$packages = $packagistClient->search($username); // didn't notice much difference between multiple requests or a generic // search with multiple results. // this could be faster if I checked here if there was a path found already $packages = []; $packageNames = $packagistClient->all(array('vendor' => $username)); foreach ($packageNames as $name) { array_push($packages, $packagistClient->get($name)); } return $packages; }
} else { $ratio = 0; } // Compute the min number of keywords if (isset($options['i'])) { $min = (int) $options['i']; } elseif (isset($options['min'])) { $min = (int) $options['min']; } else { $min = false; } // Get all keywords $client = new Packagist\Api\Client(); $keywords = []; $n = 0; $projects = $client->all(); $count = count($projects); $bar = new Dariuszp\CliProgressBar($count); echo 'Pass 1/2: Analyzing projects' . PHP_EOL; $bar->display(); foreach ($projects as $key => $name) { $bar->progress(); try { $package = $client->get($name); $versions = $package->getVersions(); if (!empty($versions)) { $n++; foreach (reset($versions)->getKeywords() as $keyword) { if (!isset($keywords[$keyword])) { $keywords[$keyword] = 0; }