baywa-re-lusy / packaging-types-api-sdk
BayWa r.e. LUSY Packaging Types API SDK
1.0.2
2025-05-27 09:04 UTC
Requires
- php: >= 8.2
- ext-curl: *
- psr/cache: ^1.0 || ^2.0|| ^3.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.1
- psr/http-message: ^1.0 || ^2.0
- psr/log: ^1.0 || ^2.0|| ^3.0
- ramsey/uuid: ^4.7
- symfony/console: ^v6.4
Requires (Dev)
- guzzlehttp/guzzle: ^7.9
- mockery/mockery: ^1.6
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^11.5
- squizlabs/php_codesniffer: ^3.7
README
This SDK can be used to retrieve Packaging Types, optionally filtered by subsidiaries or Transporeon ID.
All dependencies injected into the constructor are PSR-compatible:
- Cache : https://www.php-fig.org/psr/psr-6/
- HTTP Client : https://www.php-fig.org/psr/psr-18/
- HTTP Messages : https://www.php-fig.org/psr/psr-7/
- Logger : https://www.php-fig.org/psr/psr-3/
- HTTP Factories : https://www.php-fig.org/psr/psr-17/
Installation
composer require baywa-re-lusy/packaging-types-api-sdk
Usage
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>');
Cache Refresh via Console commands
This SDK contains a Symfony Console command to refresh the Packaging Type cache. You can include the Console command into your application:
$cliApp = new \Symfony\Component\Console\Application(); $cliApp->add(new \BayWaReLusy\PackagingTypesAPI\SDK\Console\RefreshPackagingTypesCache($packagingTypesApiClient));
And then run the Console commands with:
./console packaging-types-api-sdk:refresh-packaging-types-cache