PHP code example of pingencom / pingen2-sdk-php
1. Go to this page and download the library: Download pingencom/pingen2-sdk-php 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/ */
pingencom / pingen2-sdk-php example snippets
$provider = new \Pingen\Provider\Pingen(
array(
'clientId' => 'YOUR_OAUTH2_CLIENT_ID',
'clientSecret' => 'YOUR_OAUTH2_CLIENT_SECRET',
'staging' => true,
)
);
$access_token = $provider->getAccessToken('client_credentials');
$lettersEndpoint = (new \Pingen\Endpoints\LettersEndpoint($access_token))
->setOrganisationId('INSERT_YOUR_ORGANISATION_UUID_HERE')
->useStaging();
$lettersEndpoint->uploadAndCreate(
(new \Pingen\Endpoints\DataTransferObjects\Letter\LetterCreateAttributes())
->setFileOriginalName('your_original_pdf_name.pdf')
->setAddressPosition('left')
->setAutoSend(false),
fopen('path_to_your_original_pdf_name.pdf', 'r')
);