1. Go to this page and download the library: Download johnstef/elorus-fuse-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/ */
johnstef / elorus-fuse-php example snippets
lorusFuse\ElorusFuse;
$client = new ElorusFuse(
apiKey: 'your-api-token',
organizationVat: '999999999',
);
// List invoices for the configured organization
$result = $client->invoices()->list();
echo "Total: {$result->count}\n";
foreach ($result->results as $invoice) {
echo "[{$invoice->uid}] {$invoice->invoiceType->value} #{$invoice->number} ({$invoice->issueDate})\n";
}
use ElorusFuse\ElorusFuse;
// Point the client at the staging environment
$client = new ElorusFuse(
apiKey: 'your-api-token',
organizationVat: '999999999',
baseUrl: 'https://api.fuse-staging.gr',
);
use ElorusFuse\DTO\CreateInvoiceRequest;
use ElorusFuse\DTO\InvoiceLine;
use ElorusFuse\DTO\PaymentMethod;
use ElorusFuse\DTO\Enum\CountryCode;
use ElorusFuse\DTO\Enum\InvoiceType;
use ElorusFuse\DTO\Enum\PaymentMethodType;
$request = new CreateInvoiceRequest(
issuerVatNumber: '999999999',
invoiceType: InvoiceType::SaleInvoice,
number: '4',
issueDate: date('Y-m-d'),
lines: [
new InvoiceLine(
netValue: '100.00',
vatCategory: 1,
vatAmount: '24.00',
description: 'Consulting services',
),
],
totalNetValue: '100.00',
totalVatAmount: '24.00',
totalGrossValue: '124.00',
series: 'MT',
cpName: 'Test Customer',
cpCountry: CountryCode::GR,
cpVatNumber: '111111111',
paymentMethods: [
new PaymentMethod(type: PaymentMethodType::Cash->value, amount: '124.00'),
],
);
$invoice = $client->invoices()->create($request);
echo "UID: {$invoice->uid}\n";
echo "Mark: {$invoice->mark}\n";
echo "Auth code: {$invoice->authenticationCode}\n";
echo "QR URL: {$invoice->qrUrl}\n";
use ElorusFuse\DTO\InvoiceListFilters;
use ElorusFuse\DTO\Enum\InvoiceType;
$filters = new InvoiceListFilters(
periodFrom: '2026-01-01',
periodTo: '2026-06-30',
invoiceType: InvoiceType::SaleInvoice,
page: 1,
pageSize: 50,
);
// The organization VAT defaults to the one set on the client; pass one to override.
$result = $client->invoices()->list(filters: $filters);
foreach ($result->results as $invoice) {
echo "{$invoice->number}: {$invoice->totalGrossValue}\n";
}
use ElorusFuse\DTO\InvoiceEmailRequest;
$response = $client->invoices()->email(
$invoice->uid,
new InvoiceEmailRequest(
to: '[email protected]',
cc: ['[email protected]'],
),
);
echo "Sent to {$response->to}\n";
// Inspect the latest tracked emails for an invoice
$emails = $client->invoices()->emailLatest($invoice->uid);
use ElorusFuse\DTO\ProviderSignatureRequest;
use ElorusFuse\DTO\Enum\InvoiceType;
use ElorusFuse\DTO\Enum\PosProtocol;
$signature = $client->providerSignatures()->create(
new ProviderSignatureRequest(
protocol: PosProtocol::VivaCloud,
issuerVatNumber: '999999999',
invoiceType: InvoiceType::RetailSalesReceipt,
number: '101',
issueDate: date('Y-m-d'),
totalNetValue: '100.00',
totalVatAmount: '24.00',
totalGrossValue: '124.00',
tidNsp: 'TID-12345',
paymentAmount: '124.00',
),
);
use ElorusFuse\DTO\PaymentMethodSubmissionRequest;
use ElorusFuse\DTO\PaymentMethod;
use ElorusFuse\DTO\Enum\PaymentMethodType;
$submission = $client->paymentMethods()->update(
new PaymentMethodSubmissionRequest(
entityVatNumber: '999999999',
mark: '400001234567890',
paymentMethods: [
new PaymentMethod(type: PaymentMethodType::PosEpos->value, amount: '124.00'),
],
),
);
use ElorusFuse\DTO\DeliveryNoteCancellationRequest;
$cancellation = $client->deliveryNotes()->cancel(
new DeliveryNoteCancellationRequest(
entityVatNumber: '999999999',
mark: '400001234567890',
),
);
use ElorusFuse\Exception\AuthorizationException;
use ElorusFuse\Exception\ValidationException;
use ElorusFuse\Exception\ElorusFuseException;
try {
$invoice = $client->invoices()->create($request);
} catch (ValidationException $e) {
// Field-level errors, keyed by field name (line errors keyed by inner field)
foreach ($e->getFieldErrors() as $field => $errors) {
echo "{$field}: " . implode(', ', $errors) . "\n";
}
// Cross-field / integrity errors
foreach ($e->getIntegrityErrors() as $error) {
echo "integrity: {$error}\n";
}
// myDATA rejection errors
foreach ($e->getMydataErrors() as $error) {
echo "myDATA [{$error->code}]: {$error->message}\n";
}
if ($e->getRejectedReason() !== null) {
echo "rejected reason: {$e->getRejectedReason()}\n";
}
} catch (AuthorizationException $e) {
echo "Auth error: {$e->getMessage()}\n";
} catch (ElorusFuseException $e) {
echo "API error ({$e->getCode()}): {$e->getMessage()}\n";
}