PHP code example of germania-kg / downloadsapi-client
1. Go to this page and download the library: Download germania-kg/downloadsapi-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
germania-kg / downloadsapi-client example snippets
// Provided by interface
// Germania\DownloadsApi\DownloadsApiInterface
public function all() : iterable;
public function latest() : iterable;
public function request( string $path ) : iterable ;
public function setAuthentication( ?string $key ) : DownloadsApiInterface;
public function getAuthentication( ) : string;
use Germania\DownloadsApi\DownloadsApi;
use Germania\DownloadsApi\CacheDownloadsApiDecorator;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
$api = new DownloadsApi( ... );
$psr6 = new FilesystemAdapter( ... );
$cached_api = new CacheDownloadsApiDecorator( $api, $psr6);
$cached_api = new CacheDownloadsApiDecorator( $api, $psr6, 14400);
use Germania\DownloadsApi\DownloadsApi;
use GuzzleHttp\Client;
use Nyholm\Psr7\Factory\Psr17Factory;
$psr18 = new Client;
$psr17 = new Psr17Factory;
$key = "secret"
$api = new DownloadsApi($psr18, $psr17, $key);
use Germania\DownloadsApi\DownloadsApiExceptionInterface;
use Germania\DownloadsApi\DownloadsApiRuntimeException;
use Germania\DownloadsApi\DownloadsApiResponseException;
use Germania\DownloadsApi\DownloadsApiUnexpectedValueException;
try {
$client->latest();
}
catch (\Germania\DownloadsApi\DownloadsApiExceptionInterface $e) {
echo $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.