PHP code example of affinidi / affinidi-php-tdk

1. Go to this page and download the library: Download affinidi/affinidi-php-tdk 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 / affinidi-php-tdk example snippets


composer 

$listConfigs = $tdk->InvokeAPI('/vpa/v1/login/configurations', [], "GET");
echo "List of Configs" . print_r($listConfigs, true);

$credentials_request =
    [
        [
            "credentialTypeId" => "SchemaOne",
            "credentialData" => [
                "first_name"=> "FirstName",
                "last_name"=> "LastName",
                "dob"=> "01.01.1970",
            ]
        ]
    ];

$data = $tdk->InvokeAPI('/cis/v1/' . $_ENV['PROJECT_ID'] . '/issuance/start', [
    'data' => $credentials_request,
    'claimMode' => "TX_CODE"
]);

echo "Issuance start response" . print_r($data, true);

$data = $tdk->InvokeAPI('/ais/v1/initiate-data-sharing-request', [
    "configurationId" => "0d7acfbb-dcea-4b40-879c-f49fe918ac61", //Iota configuration Id
    "mode" => "redirect",
    "queryId" => "95e639d3-e851-4548-a7c2-be1c2e1b6da1", //Iota Query ID
    "correlationId" => "abc12334-dcea-4b40-879c-f49fe918ac61", // Your app unique id
    "nonce" => "test-nonce1", // nonce id
    "redirectUri" => 'http://localhost:8010/iota',
]);

echo "Issuance start response" . print_r($data, true);