-
app/Tiles/Statistics/Commands/FetchPackagistTotalsCommand.php
Open in GitHubuse Illuminate\Console\Command; class FetchPackagistTotalsCommand extends Command { public function handle() { $this->info('Fetching packagist totals...'); $totals = collect(Packagist::getPackagesNamesByVendor(config('services.packagist.vendor'))['packageNames']) ->map(function (string $packageName) { return Packagist::getPackage($packageName)['package']; }) ->pipe(function (Collection $packageProperties) { return [ 'monthly' => $packageProperties->sum('downloads.monthly'), 'total' => $packageProperties->sum('downloads.total'), ]; }); StatisticsStore::make()->setPackagistTotals($totals); $this->info('All done!'); } }