PHP code example of dystcz / fakturoid
1. Go to this page and download the library: Download dystcz/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/ */
dystcz / fakturoid example snippets
return [
'client_id' => env('FAKTUROID_CLIENT_ID', 'XXX'),
'client_secret' => env('FAKTUROID_CLIENT_SECRET', 'XXX'),
'account_slug' => env('FAKTUROID_ACCOUNT_SLUG'),
'user_agent' => env('FAKTUROID_USER_AGENT', 'Application <[email protected] >'),
];
use Dystcz\Fakturoid\Facades\Fakturoid;
try {
// create subject
$response = Fakturoid::getSubjectsProvider()->create([
'name' => 'Firma s.r.o.',
'email' => '[email protected] '
]);
if ($subject = $response->getBody()) {
// Create invoice with lines
$lines = [
[
'name' => 'Big sale',
'quantity' => 1,
'unit_price' => 1000
],
];
$invoiceProvider = Fakturoid::getInvoicesProvider();
$response = Fakturoid::getInvoicesProvider()->create([
'subject_id' => $subject->id,
'lines' => $lines
]);
$invoice = $response->getBody();
// Send created invoice
$invoiceProvider->fireAction($invoice->id, 'deliver');
}
} catch (\Exception $e) {
dd($e->getCode() . ": " . $e->getMessage());
}
bash
php artisan vendor:publish