PHP SDK COMMON
, (*1)
PHP SDK COMMON provide foundation for the native PHP API SDK for consuming FTVEN APIs., (*2)
Usage
Add the dependency in your composer.json :, (*3)
...
"require": {
...
"ftven/sdk-common": "1.*"
}
Then update your dependency :, (*4)
$ ./composer.phar update ftven/sdk-common
Then you can use it directly in your scripts :, (*5)
<?php
// ...
require_once '/path/to/vendor/autoload.php';
$sdk = new Ftven\Sdk\Sdk();
$result = $sdk->getApi('xyz')->myApiMethod();
// ...
As an alternative, you can use functions :, (*6)
$result = ftven_sdk_api('xyz', 'methodName', 'arg1', 'arg2', '...');
By default, API are autoloaded from the Ftven\Sdk\Api namespace, but you can add extra namespaces :, (*7)
$sdk = new Ftven\Sdk\Sdk(['My\\Other\\Namespace']);
$sdk->getApi('xyz')->...
Some APIs require that you set identities before using them :, (*8)
$sdk->setIdentity(['login' => 'me', 'pass' => 'mypass']);
...
Depending on the APIs you use, multiple identities are supported (only one per APIs) :, (*9)
$sdk->setIdentity([...], 'identityType1');
$sdk->setIdentity([...], 'identityType2');
By default, API calls are directed to 'prod' environment, but you can change to an other environment :, (*10)
$sdk->setEnvironment('preprod');
Depending on the APIs you use, multiple environments are supported (only one per APIs) :, (*11)
$sdk->setEnvironment('preprod', 'api1');
$sdk->setEnvironment('prod'); // fallback
Enjoy !, (*12)
FTVEN Build Team., (*13)