PHP code example of affinidi-tdk / affinidi-tdk-php
1. Go to this page and download the library: Download affinidi-tdk/affinidi-tdk-php 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/ */
affinidi-tdk / affinidi-tdk-php example snippets
uthProvider\AuthProvider;
use AffinidiTdk\Clients\WalletsClient;
// Configuration parameters
$params = [
'privateKey' => "", // Your private key
'keyId' => '', // Your key ID
'passphrase' => '', // Your passphrase
'projectId' => '', // Your project ID
'tokenId' => '' // Your token ID
// Optional parameters:
// 'apiGatewayUrl' => 'https://apse1.api.affinidi.io',
// 'tokenEndpoint' => 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token',
];
$authProvider = new AuthProvider($params);
try {
$tokenCallback = [$authProvider, 'fetchProjectScopedToken'];
$configCwe = WalletsClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);
$apiInstanceCwe = new WalletsClient\Api\WalletApi(
new GuzzleHttp\Client(),
$configCwe
);
$apiInstanceCwe->listWallets();
$resultCwe = $apiInstanceCwe->listWallets();
$resultCweJson = json_decode($resultCwe, true);
print_r(count($resultCweJson['wallets']));
} catch (Exception $e) {
print_r($e->getMessage());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.