PHP code example of szymsza / laravel-fakturoid

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

    

szymsza / laravel-fakturoid example snippets


return [
    'account_name' => env('FAKTUROID_NAME', 'XXX'), // URL slug of your account
    'account_api_id' => env('FAKTUROID_API_ID', 'XXX'), // found in your Fakturoid user account settings
    'account_api_secret' => env('FAKTUROID_API_SECRET', 'XXX'), // found in your Fakturoid user account settings
    'app_contact' => env('FAKTUROID_APP_CONTACT', 'Application <[email protected]>'), // linked to the application you are developing
];


use Fakturoid;

try {
    // create subject
    $subject = Fakturoid::getSubjectsProvider()->create([
        'name' => 'Firma s.r.o.',
        'email' => '[email protected]'
    ]);
    if ($subject->getBody()) {
        $subject = $subject->getBody();

        // create invoice with lines
        $lines = [
            [
                'name' => 'Big sale',
                'quantity' => 1,
                'unit_price' => 1000
            ],
        ];

        $invoice = Fakturoid::getInvoicesProvider()->create(['subject_id' => $subject->id, 'lines' => $lines]);
        $invoice = $invoice->getBody();

        // send created invoice
        Fakturoid::getInvoicesProvider()->fireAction($invoice->id, 'deliver');
    }
} catch (\Exception $e) {
    dd($e->getCode() . ": " . $e->getMessage());
}



use Fakturoid;

try {
    // create subject
    $subject = Fakturoid::createSubject(array(
        'name' => 'Firma s.r.o.',
        'email' => '[email protected]'
    ));
    if ($subject->getBody()) {
        $subject = $subject->getBody();

        // create invoice with lines
        $lines = [
            [
                'name' => 'Big sale',
                'quantity' => 1,
                'unit_price' => 1000
            ],
        ];

        $invoice = Fakturoid::createInvoice(array('subject_id' => $subject->id, 'lines' => $lines));
        $invoice = $invoice->getBody();

        // send created invoice
        Fakturoid::fireInvoice($invoice->id, 'deliver');
    }
} catch (\Exception $e) {
    dd($e->getCode() . ": " . $e->getMessage());
}


Fakturoid::createSubject([...]);

Fakturoid::->getSubjectsProvider()->create([...]);
bash
php artisan vendor:publish --provider="WEBIZ\LaravelFakturoid\FakturoidServiceProvider" --tag="config"