PHP code example of onematrix / tracing-sdk

1. Go to this page and download the library: Download onematrix/tracing-sdk 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/ */

    

onematrix / tracing-sdk example snippets


use Tracing\Sdk\SendOptions;
use Tracing\Sdk\TracingSDK;

$sdk = new TracingSDK([
    'endpoint' => 'https://indexer.example.com',
    'options'  => SendOptions::dataType('json'), // default: 'json' | 'xml' | 'raw'
    'auth'     => [
        'type'  => 'apiToken',                   // 'mTLS' | 'basic' | 'apiToken'
        'token' => 'your-api-token',
    ],
]);

// Canonicalize + hash + POST {endpoint}/api/anchors
$result = $sdk->send($rawJson, time());
// ['hash' => '0x1c8a…', 'response' => ['statusCode' => 200, 'body' => …, 'recordCount' => 1]]