PHP code example of infogrambeg / efiskalizacija-php-sdk
1. Go to this page and download the library: Download infogrambeg/efiskalizacija-php-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/ */
infogrambeg / efiskalizacija-php-sdk example snippets
use Efiskalizacija\EfiskalizacijaClient;
use Efiskalizacija\DTO\Invoice;
use Efiskalizacija\DTO\InvoiceItem;
use Efiskalizacija\DTO\Customer;
use Efiskalizacija\Enum\PaymentType;
// Kreiranje klijenta
$client = EfiskalizacijaClient::create($apiKey, $apiSecret);
// Kreiranje računa
$invoice = Invoice::create()
->setInvoiceNumber('SHOP-2026-001')
->setPaymentType(PaymentType::Kartica)
->setCashier('Web Shop')
->setCustomer(Customer::pravnoLice('123456789', 'Firma DOO'))
->addItem(new InvoiceItem(
naziv: 'Laptop HP ProBook',
kolicina: 1,
jedinicnaCena: 85000.00,
pdvStopa: 20,
sifra: 'HP-PB-450',
));
// Fiskalizacija
$result = $client->fiskalizacija()->fiskalizuj($invoice);
echo $result->pfrBroj; // "AB12CD34-Ef5Gh6i7-101"
echo $result->qrCode; // URL za QR verifikaciju
echo $result->racunId; // ID u sistemu
// Fiskalizacija računa
$result = $client->fiskalizacija()->fiskalizuj($invoice);
// Status tenanta
$status = $client->status()->fetch();
// Lista računa
$list = $client->invoices()->list(limit: 20, offset: 0);
// PDF preuzimanje
$pdf = $client->pdf()->download($pfrBroj);
$client->pdf()->downloadToFile($pfrBroj, '/path/racun.pdf');
// Slanje na email
$client->email()->send($pfrBroj, '[email protected]');
// Test (samo sandbox)
$test = $client->test()->run();
use Efiskalizacija\Enum\PaymentType;
PaymentType::Gotovina // Gotovina
PaymentType::Kartica // Platna kartica
PaymentType::Virman // Virmanski prenos
PaymentType::Vaucer // Vaučer
PaymentType::Instant // Instant plaćanje (IPS)
PaymentType::Drugo // Drugo bezgotovinsko
use Efiskalizacija\DTO\Payment;
$invoice->setSplitPayments([
new Payment(PaymentType::Gotovina, 5000.00),
new Payment(PaymentType::Kartica, 7800.00),
]);