PHP code example of bercanozcan / earsiv

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

    

bercanozcan / earsiv example snippets


return [
    'download_path' => 'faturalar', // storage/app/faturalar
];

use Bercanozcan\Earsiv\Gib;

$gib = app(Gib::class)
    ->setTestCredentials()
    ->login();

$invoice = [
    'faturaTarihi' => now()->format('d/m/Y'),
    'saat' => now()->format('H:i:s'),
    'vknTckn' => '11111111111',
    'aliciUnvan' => 'Demo Müşteri A.Ş.',
    'vergiDairesi' => 'TEST VD',
    'malHizmetTable' => [[
        'malHizmet' => 'Danışmanlık Hizmeti',
        'miktar' => 1,
        'birim' => 'HUR',
        'birimFiyat' => 1000,
        'fiyat' => 1000,
        'kdvOrani' => 20,
        'kdvTutari' => 200,
        'malHizmetTutari' => 1000,
        'iskontoOrani' => 0,
        'iskontoTutari' => 0,
        'iskontoArttm' => 'İskonto'
    ]],
    'matrah' => 1000,
    'hesaplanankdv' => 200,
    'vergilerToplami' => 200,
    'vergilerDahilToplamTutar' => 1200,
    'odenecekTutar' => 1200,
    'tip' => 'İskonto',
    'not' => 'Bu bir demo faturadır.',
];

$ettn = $gib->createDraft($invoice);

echo "Fatura oluşturuldu: $ettn";

$html = $gib->getHtml($ettn);

$path = $gib->saveToDisk($ettn);
// storage/app/faturalar/xxxx.zip

php artisan vendor:publish --tag=config --provider="Bercanozcan\\Earsiv\\EarsivServiceProvider"