LaravelPackages.net
Acme Inc.
Toggle sidebar
dystcz/laravel-fakturoid

Laravel wrapper for Fakturoid

393
5
3.1.0
About dystcz/laravel-fakturoid

dystcz/laravel-fakturoid is a Laravel package for laravel wrapper for fakturoid. It currently has 5 GitHub stars and 393 downloads on Packagist (latest version 3.1.0). Install it with composer require dystcz/laravel-fakturoid. Discover more Laravel packages by dystcz or browse all Laravel packages to compare alternatives.

Last updated

Laravel Fakturoid

Simple wrapper for official php package https://github.com/fakturoid/fakturoid-php

Docs

Installation

Step 1: Install package

Add the package in your composer.json by executing the command.

composer require dominik-wbz/laravel-fakturoid

This will both update composer.json and install the package into the vendor/ directory.

Step 2: Configuration

First initialise the config file by running this command:

php artisan vendor:publish

With this command, initialize the configuration and modify the created file, located under config/fakturoid.php.

Configuration

return [
    'account_name' => env('FAKTUROID_NAME', 'XXX'),
    'account_email' => env('FAKTUROID_EMAIL', 'XXX'),
    'account_api_key' => env('FAKTUROID_API_KEY', 'XXX'),
    'app_contact' => env('FAKTUROID_APP_CONTACT', 'Application <[email protected]>'),
];

Examples

Create Subject, Create Invoice, Send Invoice


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());
}

License

Copyright (c) 2019 - 2020 webiz eu s.r.o MIT Licensed.

Comments