Skip to content

Instantly share code, notes, and snippets.

@tomasnorre
Last active September 26, 2019 15:10
Show Gist options
  • Save tomasnorre/9d8b7193b0a01545dd30a389d855a7c6 to your computer and use it in GitHub Desktop.
Save tomasnorre/9d8b7193b0a01545dd30a389d855a7c6 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