PHP code example of zoparga / easybill
1. Go to this page and download the library: Download zoparga/easybill 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/ */
zoparga / easybill example snippets
'providers' => [
...
zoparga\EasyBill\EasybillServiceProvider::class,
];
'aliases' => [
...
'EasyBill' => zoparga\EasyBill\Facade\EasyBill::class,
];
// Search Customer with exact match
EasyBill::searchCustomer([
'company_name' => 'Company Name'
]);
// Create Customer
$customer = EasyBill::createCustomer([
'company_name' => 'Musterfirma GmbH',
'first_name' => 'Max',
'last_name' => 'Muster',
'street' => 'Musterstr. 123',
'zipcode' => '12345',
'city' => 'Musterstadt',
'emails' => ['[email protected] '],
]);
// Delete Customer
EasyBill::deleteCustomer($customer->id);
// Create Document (Invoice)
$doc = EasyBill::createDocument([
'type' => 'INVOICE',
'title' => 'Titel',
//'customer_id' => 0,
'text_prefix' => 'Hello',
'text' => 'Bye',
'items' => [
[
'type' => 'POSITION',
'number' => '123', // article number
'description' => 'Positionsbeschreibung 1',
'quantity' => 1,
'single_price_net' => 10 * 100, // cent
'vat_percent' => 19
],
[
'type' => 'TEXT',
'description' => 'Text only',
],
[
'type' => 'POSITION',
'description' => 'Positionsbeschreibung 3',
'quantity' => 1,
'single_price_net' => 20 * 100,
'vat_percent' => 19
],
],
]);
// Finish Document (set auto created document number)
$doc->done();
$pdf = EasyBill::getPDF($pdfID);
$resultPdf = $pdf->getBody();
// Update Document
EasyBill::updateDocument($id, ['status' => 'DONE']);
config/app.php