PHP code example of tonikresic / croatian-fiscalization

1. Go to this page and download the library: Download tonikresic/croatian-fiscalization 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/ */

    

tonikresic / croatian-fiscalization example snippets


$userUID = 'USER_UID';
$companyUID = 'COMPANY_UID';
$certificatePath = 'CERTIFICATE_PATH';
$certificatePassword = 'CERTIFICATE_PASSWORD';

$cf = new tonikresic\CroatianFiscalization\CroatianFiscalization();

$certificate = new tonikresic\CroatianFiscalization\Company\Certificate($certificatePath, $certificatePassword);
$company = new tonikresic\CroatianFiscalization\Company\Company($companyUID, $certificate, true, true);

$cf->configure($company);

$invoiceObject = (object) [
    'userUID' => $userUID,
    'fiscal_abbreviation' => 'G',
    'company' => $company,
    'gross' => 12.5,
    'net' => 10,
    'number' => 1,
    'business_place_label' => 1,
    'cash_register_label' => 1,
    'fiscal_data' => (object) [
        'zki' => NULL,
        'jir' => NULL
    ],
    'created_at' =>  date('Y-m-d H:i:s'),
    'fiscal_at' => NULL,
];

$response = $cf->fiscalize($invoiceObject);