Skip to content

Instantly share code, notes, and snippets.

@Konafets
Forked from tomasnorre/README.md
Created September 26, 2019 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Konafets/1b4973bb3bfaf9084d6f888933e83121 to your computer and use it in GitHub Desktop.
Save Konafets/1b4973bb3bfaf9084d6f888933e83121 to your computer and use it in GitHub Desktop.

What does it do?

This littel script fetches all packages, listed on packagist with type typo3-cms-extension, and iterates over them and collect download data for every single packages.

It will echo it as csv, so it can easily be parsed into a .csv file for better sorting etc.

How to generate csv file

$ php fetchExtensionDownloadDataFromPackagist.php > downloadData.csv
<?php
$extensions = json_decode(file_get_contents('https://packagist.org/packages/list.json?type=typo3-cms-extension'), true);
foreach ($extensions['packageNames'] as $packageName) {
$package = json_decode(file_get_contents("https://packagist.org/packages/$packageName/downloads.json"), true);
echo $packageName . ';' .$package['package']['downloads']['total']['total'] . chr(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment