1. Go to this page and download the library: Download crmleaf/invoice-generator 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/ */
crmleaf / invoice-generator example snippets
use Crmleaf\Payroll\Calculators\InvoiceGenerator;
use Crmleaf\Payroll\Money;
$result = (new InvoiceGenerator())->calculate(
invoiceNumber: 'INV-2025-0001',
invoiceDate: new \DateTimeImmutable('2025-08-01'),
sellerState: 'Karnataka',
buyerState: 'Maharashtra',
items: [
[
'description' => 'Payroll processing services',
'sac' => '998221',
'quantity' => 1,
'rate' => 50000,
'gstRate' => 18,
],
],
);
echo $result->explain(); // the formula with the real operands in it
echo $result->workings(); // every step, one per line, with its citation
print_r($result->toArray()); // snake_case, ready for JSON
use Crmleaf\Payroll\Tools\InvoiceGenerator\Documents\InvoiceGeneratorDocument;
return app(InvoiceGeneratorDocument::class)->download($result, 'invoice-generator.pdf');