Skip to content

Synerise/php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synerise PHP SDK


About

Synerise SDK for PHP. Allows access to Synerise APIs and overall integration.

Requirements

  • A Synerise workspace API Key
  • PHP 7.4+

Installing Synerise SDK with Composer

SDK is available over packagist. Some dependencies are optional and can be replaced with custom implementations

  1. You can install it with the following command:
composer require synerise/php-sdk
  1. Install suggested dependencies
composer require mobiledetect/mobiledetectlib

Initialization

The 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.

Using ClientBuilder

ClientBuilder requires a Synerise\Sdk\Api\Config implementation, which would contain the set of api settings.

  1. 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);
  1. 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);

Token Caching

The SDK supports token caching to reduce authentication requests:

With PSR Cache (Recommended)

// 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

Changelog can be found here.

Author

Synerise, developer@synerise.com. If you need support please feel free to contact us.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages