Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 113 lines (69 sloc) 3.83 KB

Logo

PHP Wrapper for The Imaging Source Download System Web API

Coverage Status Scrutinizer Code Quality Total Downloads Latest Stable Version

The Imaging Source produces a large number of downloadable files (drivers, end-user software, documentation, images etc.). These resources are published at dl.theimagingsource.com and are available via a JSON-based API. In addition to encapsulating the functionality of the JSON-based API, this component library provides several helper objects to make access to The Imaging Source downloads as simple and quick as possible.

Installation

Use Composer to install the SDK:

composer require theimagingsource/tisd-sdk ^4.0

Sample Endpoints

Return all supported locales

Return all supported contexts

Return meta information and statistics

Return all data (consolidated)

Return all packages in "Downloads"

Return all packages in "Downloads" -> "Drivers"

Return package matching product code ID

Return package matching package ID

Return package matching UUID

Programming Samples

The SDK ships with comprehensive samples illustrating all functionality. Please take a look in the /bin directory.

Unit Tests

The SDK ships with complete unit tests. Simply run composer test in the root directory.

JSON Structure

root
  categories
    sections
      packages
        package

Loop through the JSON structure in PHP

<?php

use Tisd\Sdk\Sdk;

$sdk = new Sdk();

$packages = $sdk->getPackages();

foreach ($packages['children'] as $categoryId => $categories) {
    foreach ($categories['children'] as $sectionId => $sections) {
        foreach ($sections['children'] as $packageId => $package) {
            // $latestPackageVersion = array_shift($package['versions']);
        }
    }
}

foreach ($packages['children'] as $categoryId => $categories) {
    foreach ($categories['children'] as $sectionId => $sections) {
        foreach ($sections['children'] as $packageId => $package) {
            // $latestPackageVersion = array_shift($package['versions']);
        }
        if (0 === count($packages['children'][$categoryId]['children'][$sectionId]['children'])) {
            unset($packages['children'][$categoryId]['children'][$sectionId]);
        }
    }
    if (0 === count($packages['children'][$categoryId]['children'])) {
        unset($packages['children'][$categoryId]);
    }
}

?>