PHP code example of yuramozol / com.docstudio.api.php-client

1. Go to this page and download the library: Download yuramozol/com.docstudio.api.php-client 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/ */

    

yuramozol / com.docstudio.api.php-client example snippets




   DocStudio\Client\Configuration;
  use DocStudio\Client\Model\LoginDTO;
  use DocStudio\Client\Model\QuickSendDTO;
  use DocStudio\Client\Model\QuickSendRecipientDTO;
  use DocStudio\Client\Api\EnvelopeControllerApi;
  use DocStudio\Client\Api\AuthenticationControllerApi;
  
  
  $httpClient = new GuzzleHttp\Client([
          'timeout' => 30,
          'connect_timeout' => 30,
          'read_timeout' => 30
      ]
  );
  
  $username = '[email protected]';
  $password = 'password';
  
  $loginController = new AuthenticationControllerApi($httpClient);
  $token = $loginController->login((new LoginDTO())->setLogin($username)->setPassword($password))->getToken();
  
  echo 'Token: ' . $token . PHP_EOL;
  
  $configuration = new Configuration();
  $configuration->setUserAgent('Demo integration')->setAccessToken($token);
  $configuration->setDebug(true);
  $configuration->setDebugFile(__DIR__ . '/debug.log');
  
  $mailboxController = new DocStudio\Client\Api\MailboxControllerApi($httpClient, $configuration);
  $mailboxUuid = $mailboxController->getAllForUser()[0]->getMailboxUuid();
  $envelopeController = new EnvelopeControllerApi($httpClient, $configuration);
  
  $quickSendRequest = new QuickSendDTO();
  $quickSendRequest->setSubject('Test envelope')->setMessage('Test envelope message');
  $sender = new QuickSendRecipientDTO();
  $recipients = [];
  $sender->setRecipient($mailboxUuid)->setSigner(true)->setEInkSignature(true);
  $recipients[] = $sender;
  $recipient = new QuickSendRecipientDTO();
  $recipient->setRecipient('[email protected]')->setSigner(true)->setEInkSignature(true);
  $recipients[] = $recipient;
  $quickSendRequest->setRecipients($recipients);
  
  $uuid = $envelopeController->quickSendExternalDocuments($mailboxUuid, [new SplFileObject(__DIR__ . '/singlepage.pdf')], $quickSendRequest);
  echo $uuid->getUuid() . PHP_EOL;

composer