PHP code example of germania-kg / fabricsapi-client

1. Go to this page and download the library: Download germania-kg/fabricsapi-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 / fabricsapi-client example snippets



use Germania\FabricsApiClient\FabricsApiClient;

$guzzle = new \GuzzleHttp\Client([
  // Note the trailing slash!
  'base_uri' => "https://path/to/api/"
]);

$reader = new FabricsApiClient($guzzle);


use Germania\FabricsApiClient\CacheFabricsApiClient;

$api_reader = new FabricsApiClient($guzzle);
$psr6 = ...;
$lifetime = 86400;

$reader = new CacheFabricsApiClient($api_reader, $psr6, $lifetime);

// iterable
$all_fabrics = $reader->collection("anyCollection");

// Sort by pattern
$all_fabrics = $reader->collection("anyCollection", null, "pattern");

// iterable
$matching_fabrics = $reader->collection("anyCollection", "seaflower");

// Sort by pattern
$matching_fabrics = $reader->collection("anyCollection", "seaflower", "pattern");

// Germania\Fabrics\FabricInterface
$single = reader->fabric("anyCollection", "1-2345");