PHP code example of robo-meister / accord-flow-api
1. Go to this page and download the library: Download robo-meister/accord-flow-api 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/ */
robo-meister / accord-flow-api example snippets
ccordFlow\AccordFlowClient;
$client = new AccordFlowClient(
baseUrl: 'http://localhost:8080',
bearerToken: getenv('ACCORDFLOW_TOKEN') ?: null,
tenantId: getenv('ACCORDFLOW_TENANT') ?: null,
);
$status = $client->status();
$response = $client->sign([
'envelopeId' => 456,
'data' => 'Hello world',
'documentType' => 'txt',
'profile' => [
'countryCode' => 'PL',
'type' => 'EXTERNAL',
'mode' => 'RAW',
],
'username' => 'demo',
'consent' => [
'accepted' => true,
'method' => 'CHECKBOX',
],
]);
$signature = $response['signature'] ?? null;
$redirectUrl = $response['redirectUrl'] ?? null;
$signed = $client->signFile('/path/to/document.pdf', 456, [
'profileId' => 123,
]);
$verification = $client->verifyFile(
'/path/to/document.pdf',
$signed['signature'],
['profileId' => 123],
);
// File signing also
$usage = $client->get('/api/auth/usage/demo');
$createdUser = $client->post('/api/auth/signup', [
'username' => 'demo',
'password' => 'change-me',
]);
use AccordFlow\AccordFlowException;
try {
$client->verify([
'data' => 'Hello world',
'signature' => $signature,
'documentType' => 'txt',
'username' => 'demo',
]);
} catch (AccordFlowException $error) {
error_log($error->getMessage());
error_log((string) $error->getStatusCode());
}