PHP code example of vlsv / platformaofd-api-client

1. Go to this page and download the library: Download vlsv/platformaofd-api-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/ */

    

vlsv / platformaofd-api-client example snippets


try {
    /** @var \Platformaofd\ClientApi\Model\ResponseKktList $responseKktList */
    $responseKktList = $this->apiClient->sendRequest(
        token: 'access_token',
        apiEndpoint: \Platformaofd\ClientApi\Model\ApiEndpoint::KKTS,
    );
} catch (ApiException $exception) {
    echo $exception->getMessage();

    exit();
}

$dateFrom = new DateTimeImmutable('2023-05-06 10:00:00');
$dateTo = new DateTimeImmutable('2023-06-06 10:00:00');
$requestDocuments = (new \Platformaofd\ClientApi\Model\RequestDocuments())
    ->setRnm('0000000123456789')
    ->setDateFrom($dateFrom)
    ->setDateTo($dateTo);
    
try {
    /** @var \Platformaofd\ClientApi\Model\ResponseDocuments $responseDocuments */
    $responseDocuments = $this->apiClient->sendRequest(
        token: 'access_token',
        apiEndpoint: \Platformaofd\ClientApi\Model\ApiEndpoint::ALL_DOCUMENTS,
        requestObject: $requestDocuments
    );
} catch (ApiException $exception) {
    echo $exception->getMessage();

    exit();
}

$receiptDate = new DateTimeImmutable('2023-05-06 10:00:00');
$requestReceiptsWithTag1084 = (new \Platformaofd\ClientApi\Model\RequestReceiptsWithTag1084())
    ->setReceiptDate($receiptDate)
    ->setKktRegIds(['0000000000000000', '0000000000000001'])
    ->setProperties1084(['значение1', 'значение2']);
    
try {
    /** @var \Platformaofd\ClientApi\Model\ResponseReceiptsWithTag1084 $responseReceiptsWithTag1084 */
    $responseReceiptsWithTag1084 = $this->apiClient->sendRequest(
        token: 'access_token',
        apiEndpoint: \Platformaofd\ClientApi\Model\ApiEndpoint::WITH_TAG1084,
        requestObject: $requestReceiptsWithTag1084
    );
} catch (ApiException $exception) {
    echo $exception->getMessage();

    exit();
}