1. Go to this page and download the library: Download clicksports/lex-office-api 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/ */
clicksports / lex-office-api example snippets
// store keys in .env file
$apiKey = getenv('LEXOFFICE_API_KEY');
// in this example we are using guzzlehttp/guzzle package, it can be any PSR-18 HTTP Client
// see: https://packagist.org/providers/psr/http-client-implementation
$httpClient = \GuzzleHttp\Client();
$api = new \Sysix\LexOffice\Api($apiKey, $httpClient);
$response = $api->file()->upload($filePath, $voucherType);
$response = $api->file()->get($entityId); // accept every file
$response = $api->file()->get($entityId, 'image/*'); // accept only images
$response = $api->file()->get($entityId, 'application/xml'); // get XRechung XML File (if possible)
$voucherList = $api->invoice()->getVoucherListClient(); // see VoucherlistClient Documentation
$response = $api->invoice()->get($entityId);
$response = $api->invoice()->create($data);
$response = $api->invoice()->create($data, true); // finalized
$response = $api->invoice()->pursue($precedingSalesVoucherId, $data);
$response = $api->invoice()->pursue($precedingSalesVoucherId, $data, true); // finalized
$response = $api->invoice()->document($entityId); // get document ID
$response = $api->invoice()->document($entityId, true); // get file content
$response = $api->invoice()->document($entityId, true, 'image/*'); // accept only images
$response = $api->invoice()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
$voucherList = $api->orderConfirmation()->getVoucherListClient(); // see VoucherlistClient Documentation
$response = $api->orderConfirmation()->get($entityId);
$response = $api->orderConfirmation()->create($data);
$response = $api->orderConfirmation()->pursue($precedingSalesVoucherId, $data);
$response = $api->orderConfirmation()->document($entityId); // get document ID
$response = $api->orderConfirmation()->document($entityId, true); // get file content
$response = $api->orderConfirmation()->document($entityId, true, 'image/*'); // accept only images
$response = $api->payment()->get($entityId);
$response = $api->paymentCondition()->getAll();
$response = $api->postingCategory()->getAll();
$response = $api->printLayout()->getAll();
$response = $api->profile()->get();
$voucherList = $api->quotation()->getVoucherListClient(); // see VoucherlistClient Documentation
$response = $api->quotation()->get($entityId);
$response = $api->quotation()->create($data);
$response = $api->quotation()->create($data, true); // finalized
$response = $api->quotation()->document($entityId); // get document ID
$response = $api->quotation()->document($entityId, true); // get file content
$response = $api->quotation()->document($entityId, true, 'image/*'); // accept only images
$client = $api->recurringTemplate();
// filters
$client->size = 100;
$client->sortDirection = 'DESC';
$client->sortColumn = 'updatedDate';
// get a page
$response = $client->getPage(0);
// other methods
$response = $api->recurringTemplate()->get($entityId);
$response = $api->voucher()->get($entityId);
$response = $api->voucher()->create($data);
$response = $api->voucher()->update($entityId, $data);
$response = $api->voucher()->document($entityId); // get document ID
$response = $api->voucher()->document($entityId, true); // get file content
$response = $api->voucher()->document($entityId, true, 'image/*'); // accept only images
$response = $api->voucher()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
$response = $api->voucher()->upload($entitiyId, $filepath);
$client = $api->voucherlist();
$client->size = 100;
$client->sortDirection = 'DESC';
$client->sortColumn = 'voucherNumber';
// filters aymentinvoice',
'creditnote',
'orderconfirmation',
'quotation'
];
$client->statuses = [
'draft',
'open',
'paid',
'paidoff',
'voided',
//'overdue', overdue can only be fetched alone
'accepted',
'rejected'
];
// filters optional
$client->archived = true;
$client->contactId = 'some-uuid-string';
$client->voucherDateFrom = new \DateTime('2023-12-01');
$client->voucherDateTo = new \DateTime('2023-12-01');
$client->createdDateFrom = new \DateTime('2023-12-01');;
$client->createdDateTo = new \DateTime('2023-12-01');
$client->updatedDateFrom = new \DateTime('2023-12-01');
$client->updatedDateTo = new \DateTime('2023-12-01');
// get a page
$response = $client->getPage(0);
// can be possible null because the response body can be empty
$json = \Sysix\LexOffice\Utils::getJsonFromResponse($response); // as object
$json = \Sysix\LexOffice\Utils::getJsonFromResponse($response, true); // as associative array
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.