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



    use DocStudio\Client\ApiException;
    use 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);
    
    $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);

    $envelopeController->quickSendExternalDocuments(['/app/sample.pdf', '/app/sample2.pdf'], $quickSendRequest, $mailboxUuid);

composer