1. Go to this page and download the library: Download aichadigital/larabill 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/ */
// Model with UUID
use AichaDigital\Larabill\Concerns\HasUuid;
class Invoice extends Model
{
use HasUuid;
}
// Migration
$table->uuid('id')->primary();
// Assign the base-100 integer (€12.34 → 1234):
$invoice->total_amount = 1234;
// Reading the attribute returns a FixedDecimal value object
// (base-100 backed, scale 2) — not a raw int:
$money = $invoice->total_amount; // FixedDecimal
use AichaDigital\Larabill\Services\TaxCalculationService;
$taxService = app(TaxCalculationService::class);
// Calculate taxes for a single line. Amounts are base-100 integers. The
// applicable rate (Spanish IVA, Canary IGIC, Ceuta/Melilla IPSI, EU reverse
// charge or destination VAT) is resolved from the TaxGroup and the customer's
// fiscal profile — not passed in directly.
$result = $taxService->calculateForInvoiceItem([
'quantity' => 100, // base-100: 1.0 unit
'base_price' => 10000, // base-100: €100.00
'tax_group_id' => $taxGroup->id,
'billable_user_id' => $user->id, // optional: drives B2B / destination rules
]);
// $result keys (base-100 integers + breakdown):
// taxable_amount, total_tax_amount, total_amount, tax_group_id, taxes_applied
use AichaDigital\Larabill\Actions\VerifyVatNumber;
// Pass the VAT number WITHOUT the country prefix ("B12345678", not "ESB12345678").
$result = VerifyVatNumber::run('B12345678', 'ES');
if ($result['is_valid']) {
echo 'Valid VAT for: '.$result['company_name'];
}
use AichaDigital\Larabill\Models\CompanyFiscalConfig;
// Get current active config
$config = CompanyFiscalConfig::getActive();
// Create new config (the previous active one is auto-closed)
$newConfig = CompanyFiscalConfig::createNew([
'tax_id' => 'ESB12345678',
'business_name' => 'Your Company S.L.',
'address' => 'Calle Test 123',
'city' => 'Madrid',
'zip_code' => '28001',
'country_code' => 'ES',
'is_oss' => true,
'valid_from' => now(),
]);
use AichaDigital\Larabill\Models\UserTaxProfile;
// Get the active fiscal profile for a user
$profile = UserTaxProfile::getActiveForOwner($user->id);
// Create a new profile (previous stays as history)
$newProfile = UserTaxProfile::createForOwner($user->id, [
'fiscal_name' => 'Client SARL',
'tax_id' => 'FR12345678901',
'country_code' => 'FR',
'is_company' => true,
]);