PHP code example of fobo / datamaker-sdk

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

    

fobo / datamaker-sdk example snippets


use DataMaker\Sdk\Client;

$dmf = file_get_contents('contact.dmf');

$result = Client::submit([
    'dmf'    => $dmf,                                  // verifies signature + form hash
    'values' => ['email' => '[email protected]', 'full_name' => 'Ada'],
]);
// => ['submissionId' => '...', 'editToken' => '...', 'formId' => 'contact_form']

use DataMaker\Sdk\DmfReader;

$form = DmfReader::read($dmf);

if ($form->isFoboVerified()) {
    $a = $form->foboVerification;
    echo "Verified by FOBO as {$a['email']}";        // + $a['company'] when admin-verified
}
if ($form->acceptsSubmissions()) {
    // sealed-box recipient present — submissions are E2E-encrypted to the publisher
}

use DataMaker\Sdk\Client;
use DataMaker\Sdk\DmfReader;

$form  = DmfReader::read($dmf);
$built = Client::buildSubmission($form, ['email' => '[email protected]']);
// $built['envelope'] is the SubmissionEnvelope; POST it yourself, or:
$result = Client::postSubmission($built['envelope']);