Download the PHP package germania-kg/downloadsapi-client without Composer

On this page you can find all versions of the php package germania-kg/downloadsapi-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package downloadsapi-client


DownloadsApi Client

Server-side PHP client for retrieving a list of available downloads from Germania's Downloads API.

Packagist PHP version Tests

Installation

The v5 release is a complete rewrite, so there is no “upgrading” procedure.

This package requires a PSR-18 HTTP client implementation and a PSR-17 HTT factory implementation. Suggestions are Guzzle 7 via guzzlehttp/guzzle and Nyholm's nyholm/psr7 which (despite its name) provides the PSR-17 factories as well:

Basics

Interface and abstract class

Interface DownloadsApiInterface provides public methods for retrieving documents, all and latest and request, with the latter for internal use. All of these return an iterable. There are also interceptors for the authentication key:

Abstract class DownloadsApiAbstract prepares the all and latest methods to delegate directly to the request method. It also utilizes various useful traits such as Psr\Log\LoggerAwareTrait, LoglevelTrait and AuthenticationTrait. – So any class extending this abstract will thus provide:

PSR-6 Cache Support

Class CacheDownloadsApiDecorator wraps an existing DownloadsApi instance and adds support for PSR-6 Caches. It extends DownloadsApiDecorator which itself extends DownloadsApiAbstract, so the class also implements DownloadsApiInterface.

The constructor requires a DownloadsApi (or DownloadsApiInterface) instance and a PSR-6 Cache Item Pool. You may optionally pass a cache lifetime in seconds which defaults to 14400 (4 hours).

The API client

The DownloadsApi API client extends DownloadsApiAbstract und thus implements DownloadsApiInterface. The constructor requires a PSR-18 HTTP Client, a PSR-17 Request factory and an API key. – To obtain an API key, ask the web developers over at Germania KG.

Retrieve documents

Public methods all and latest return an Array iterable with the documents provided by Germania's Documents API.

Example record

The above print_r( $document ) will reveal something like this:

Filtering results

To narrow down the results, both the all and latest methods accept an array with filter values. The fiter values may contain multiple values, separated with comma.

Think of the filter array items as WHERE … AND… clauses, and comma-separated values as 'a' OR 'b'

Errors and Exceptions

It should be plenty to watch out for \Germania\DownloadsApi\Exceptions\DownloadsApiExceptionInterface since all concrete exception classes implement this interface.

Exceptions during request: Whenever a PSR-18 client request fails, a DownloadsApiRuntimeException will be thrown. This class implements DownloadsApiExceptionInterface and extends \RuntimeException.

HTTP Error responses: When a API call returns an HTTP error response, a DownloadsApiResponseException will be thrown. This class implements DownloadsApiExceptionInterface and extends \RuntimeException.

Unexpected values in response: Whenever a response (even with status 200 OK) can't be decoded to an useful array, a DownloadsApiUnexpectedValueException will be thrown. This class implements DownloadsApiExceptionInterface and extends \UnexpectedValueException.

Unit tests and development

Copy phpunit.xml.dist to phpunit.xml and fill in the Authentication data you obtained from Germania.

In order to run unit tests, run PhpUnit like this:

Issues

See full issues list.


All versions of downloadsapi-client with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
germania-kg/response-decoder Version ^1.0
psr/log Version ^1.1
psr/cache Version ^1.0|^2.0|^3.0
psr/http-factory Version ^1.0
psr/http-client Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package germania-kg/downloadsapi-client contains the following files

Loading the files please wait ....