PHP code example of quantum3k / erply-sdk

1. Go to this page and download the library: Download quantum3k/erply-sdk 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/ */

    

quantum3k / erply-sdk example snippets


$api = \ErplyAPI::getInstanceWithCredentials($code, $username, $password);
$api->setThrow(false);
$api->setRecordsOnPage(40);

use ErplyAPI;

$doc = new DTO\SaleDocument();

$row = $doc->addRow();
$row->rowID = 100;
$row->code = 2048;

$row = $doc->addRow();
$row->rowID = 200;
$row->code = 4096;

$api->saveSalesDocument($doc);

$response = $api->getSalesDocuments(['clientIDs' => '128, 256, 512, 1024']);

foreach ($response as $record) {
    echo "Client {$record->clientName}, with email: {$record->clientEmail}" . PHP_EOL;
}

// Стандартный запрос
$response = $api->stdRequest($params);  
// Пакетный запрос
$response = $api->bulkRequest($params);

$response = $api->stdRequest([$api::STD_REQ => 'getCustomers', 'searchName' => 'John']);

$response = $api->bulkRequest([
    [$api::BULK_REQ => 'getCustomers', 'searchPersonFirstName' => 'John'],
    [$api::BULK_REQ => 'getVatRates'],
    [$api::BULK_REQ => 'getEmployees'],
]);

$response = $api->getBulkResponse([
    [$api::BULK_REQ => 'getCustomers', 'searchPersonFirstName' => 'John'],
    [$api::BULK_REQ => 'getVatRates'],
    [$api::BULK_REQ => 'getEmployees'],
]);
$collections = $response->getRequests();