PHP code example of coriolis / sell-and-sign

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

    

coriolis / sell-and-sign example snippets



use QH\Sellandsign\{
    Configuration,
    ContractLoader,
    DTO\Request
};
use Symfony\Component\HttpClient\HttpClient;

//init the configuration
$configuration = (new Configuration)
    ->setApiUrl("THE_API_URL")
    ->setHttpclient(HttpClient::create())
    ->setToken("THE_TOEKN")
    ->setLicenseId("THE_LICENSE_ID");
    
$contractLoader = new ContractLoader($configuration);

/**
* Retrive all contract
 */
 
//You must provide an instance of Request
$request = new Request; //this class offers you certain method to specify filters
$contracts = $contractLoader->getContracts($request); //return an instance of ContractCollection


/**
* Retrieve a contract
 */
 $contract = $contractLoader->getContract(1234); // return an instance of Contract or null


use QH\Sellandsign\{
    Configuration,
    FileLoader
};
use Symfony\Component\HttpClient\HttpClient;

//init the configuration
$configuration = (new Configuration)
    ->setApiUrl("THE_API_URL")
    ->setHttpclient(HttpClient::create())
    ->setToken("THE_TOEKN")
    ->setLicenseId("THE_LICENSE_ID");
    
$fileLoader = new FileLoader($configuration);

$fileContent = $this->fileLoader->getCurrentDocumentForContract(1234); //return the content of the file in string

//You can write a file with the content
$filename = "someName.pdf";
$pathOfDirectory = "/path/of/directory/";
$file = fopen($pathOfDirectory . $filename , 'w');
fwrite($file, $fileContent);
fclose($fileHandler);


use QH\Sellandsign\{
    Configuration,
    MemberLoader,
    DTO\MemberRequest
};
use Symfony\Component\HttpClient\HttpClient;

//init the configuration
$configuration = (new Configuration)
    ->setApiUrl("THE_API_URL")
    ->setHttpclient(HttpClient::create())
    ->setToken("THE_TOEKN")
    ->setLicenseId("THE_LICENSE_ID");
    
$memberLoader = new MemberLoader($configuration);

$request = new MemberRequest();
$members = $memberLoader->getMembers($request); //return an instance of MemberCollection

//You can do a search, for example a search on an email 
//it will be necessary to modify the request 
$request = new MemberRequest();
$request->setSearchString("[email protected]");
$members = $memberLoader->getMembers($request); //return an instance of MemberCollection