PHP code example of baywa-re-lusy / packaging-types-api-sdk

1. Go to this page and download the library: Download baywa-re-lusy/packaging-types-api-sdk 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/ */

    

baywa-re-lusy / packaging-types-api-sdk example snippets


use Laminas\Cache\Storage\Adapter\Apcu;

$tokenCache  = new \Laminas\Cache\Psr\CacheItemPool\CacheItemPoolDecorator(new Apcu());
$resultCache = new \Laminas\Cache\Psr\CacheItemPool\CacheItemPoolDecorator(new Apcu());
$httpFactory = new \Nyholm\Psr7\Factory\Psr17Factory();
$httpClient  = new \GuzzleHttp\Client();

$packagingTypesApiClient = new \BayWaReLusy\PackagingTypesAPI\SDK\PackagingTypesApiClient(
    "<URL to Packaging Types API>",
    "<URL to Token API Endpoint>",
    "<Client ID>",
    "<Client Secret>",
    $tokenCache,
    $resultCache,
    $httpFactory,
    $httpFactory,
    $httpClient    
);

$packagingTypes = $packagingTypesApiClient->getPackagingTypes();
$packagingType  = $packagingTypesApiClient->getPackagingType('<id>');
$packagingType  = $packagingTypesApiClient->findOneByTransporeonId('<Transporeon ID>');

$cliApp = new \Symfony\Component\Console\Application();
$cliApp->add(new \BayWaReLusy\PackagingTypesAPI\SDK\Console\RefreshPackagingTypesCache($packagingTypesApiClient));