PHP code example of erikgreasy / superfaktura-client

1. Go to this page and download the library: Download erikgreasy/superfaktura-client 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/ */

    

erikgreasy / superfaktura-client example snippets


use Erikgreasy\Superfaktura\Superfaktura;

$sf = new Superfaktura(
    email: '[email protected]',
    apiKey: 'vygenerovany_api_kluc',
    isSandbox: true // pouzitie sandbox modu - optional parameter
);

$response = $sf
    ->newInvoice()
    ->setClient([
        'name' => 'Klient s.r.o.'
    ])
    ->addItem([
        'name' => 'Položka 1',
        'unit_price' => 20,
    ])
    ->addItem([
        'name' => 'Položka 2',
        'unit_price' => 20,
        'quantity' => 2,
    ])
    ->save();