php-dataset/bin/dataset-info

30 lines
732 B
Plaintext
Raw Permalink Normal View History

2022-10-30 17:38:43 +00:00
#!/usr/bin/env php
<?php
foreach ([
__DIR__."/../vendor",
2022-10-30 22:02:14 +00:00
__DIR__."/../../../vendor",
__DIR__."/vendor",
2022-10-30 17:38:43 +00:00
] as $dir) {
if (file_exists($dir."/autoload.php")) {
2022-10-30 22:02:14 +00:00
define("COMPOSER_VENDOR_PATH", $dir);
2022-10-30 17:38:43 +00:00
require_once $dir."/autoload.php";
}
}
$datasetManager = new NoccyLabs\Dataset\DatasetManager();
$datasets = $datasetManager->getAvailableDatasets();
foreach ($datasets as $dataset) {
2022-10-30 22:02:14 +00:00
echo $dataset->getIdentifier()." (".$dataset->getVersion().")\n";
$reader = $dataset->open();
$rows = 0;
$headers = null;
foreach ($reader as $row) {
if (!$headers) $headers = array_keys($row);
$rows++;
}
echo " ".$rows." rows\n - ".join("\n - ",$headers)."\n";
2022-10-30 17:38:43 +00:00
}