PHP code example of cyril-bochet / yousign-api-client-v3
1. Go to this page and download the library: Download cyril-bochet/yousign-api-client-v3 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/ */
cyril-bochet / yousign-api-client-v3 example snippets
use YousignApiClient\YousignApiClient;
use YousignApiClient\SignatureRequest;
$apikey = 'API_KEY';
$env = 'test';
$client = new YousignApiClient($apikey, $env);
// Nouvelle requête
$signatureRequest = new SignatureRequest(string $name, string $deliveryMode, string $timezone, bool $orderedSigners);
$signatureRequest = new SignatureRequest('Contrat', 'email', 'Europe/Paris', true);
// Optionel
$signatureRequest->setCustomExperienceId("xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx");
$client->initiateSignatureRequest($signatureRequest);
use YousignApiClient\Document;
$document = new Document(string $nature, string $path, bool $parseAnchors);
$document = new Document('signable_document', 'contrat.pdf', true);
$client->addDocument($document);
$documentId = $document->getId();
use YousignApiClient\Signer;
$signer = new Signer(string $firstName, string $lastName, string $email, ?string $phoneNumber, string $locale, ?string $signatureAuthenticationMode, ?string $signatureLevel);
$signer = new Signer("Jean", "DUPOND", '[email protected]', '+33123456789', 'fr', 'otp_sms', 'electronic_signature');
use YousignApiClient\Font;
$font = new Font(string $family, string $color, int $size = 12);
$font = new Font('Raleway', '#000000', 9);
use YousignApiClient\Webhook\Scope;
use YousignApiClient\Webhook\Webhook;
use YousignApiClient\Webhook\WebhookEvent;
// Nouveau Webhook
$allEvents = new WebhookEvent('*');
$event = new WebhookEvent('signature_request.done');
$allScopes = new Scope('*');
$scope = new Scope('public_api');
$webhook = new Webhook(bool $sandbox, bool $autoRetry, bool $enabled, string $endpoint, string $description, array $events, array $scopes);
$webhook = new Webhook(true, true, true, 'endpoint.fr', 'test', [$allEvents], [$allScopes]);
$client->createWebhook($webhook);
// Liste des Webhooks
$webhooks = $client->listWebhooks();