Synerise SDK for PHP. Allows access to Synerise APIs and overall integration.
- A Synerise workspace API Key
- PHP 7.4+
SDK is available over packagist. Some dependencies are optional and can be replaced with custom implementations
- You can install it with the following command:
composer require synerise/php-sdk- Install suggested dependencies
composer require mobiledetect/mobiledetectlibThe repository provides autogenerated api clients that can be utilized on their own.
There's also a single entry point ClientBuilder which helps to initialize and authorized all the apis.
ClientBuilder requires a Synerise\Sdk\Api\Config implementation, which would contain the set of api settings.
- Initializing the api with
ClientBuilder:
use Synerise\Sdk\Api\ClientBuilder;
use Synerise\Sdk\Api\Config;
/** @var Config $config implementation of Config interface */
$clientBuilder = new ClientBuilder($config);- Optionally you can also provide your own RequestAdapter:
use Microsoft\Kiota\Abstractions\RequestAdapter;
use Synerise\Sdk\Api\ClientBuilder;
use Synerise\Sdk\Api\Config;
/**
* @var Config $config implementation of Config interface
* @var RequestAdapter $requestAdapter implementation of RequestAdapter interface
*/
$clientBuilder = new ClientBuilder($config, $requestAdapter);The SDK supports token caching to reduce authentication requests:
// Install cache implementation
composer require symfony/cache
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Synerise\Sdk\Api\Authentication\TokenProviderFactory;
$cache = new RedisAdapter(RedisAdapter::createConnection('redis://localhost'));
$tokenProvider = TokenProviderFactory::createWithPsrCache($config, $cache);Changelog can be found here.
Synerise, developer@synerise.com. If you need support please feel free to contact us.