PHP code example of proovit / laravel-billing

1. Go to this page and download the library: Download proovit/laravel-billing 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/ */

    

proovit / laravel-billing example snippets


config([
    'billing.database.enabled' => true,
    'billing.api.enabled' => true,
    'billing.api.auth_middleware' => ['auth:sanctum'],
    'billing.public_shares.enabled' => true,
    'billing.docs.enabled' => true,
]);

$document = \Proovit\Billing\Builders\Documents\InvoiceDocumentBuilder::make()
    ->withSeller([
        'legal_name' => 'ProovIT SAS',
        'display_name' => 'ProovIT',
        'address' => ['line1' => '1 rue de Paris', 'city' => 'Paris', 'country' => 'FR'],
    ])
    ->withCustomer([
        'legal_name' => 'Acme Ltd',
        'reference' => 'ACME-001',
        'billing_address' => ['line1' => '2 avenue des Tests', 'city' => 'Lyon', 'country' => 'FR'],
    ])
    ->addLine([
        'description' => 'Consulting',
        'quantity' => '1',
        'unit_price' => '250.00',
        'tax_rate' => '20',
    ])
    ->withNumber('INV-2026-0001')
    ->withIssuedAt(now())
    ->withDueAt(now()->addDays(30))
    ->withLocale('en')
    ->validate()
    ->build();

$pdf = app(\Proovit\Billing\Actions\Invoices\GenerateInvoicePdfAction::class)->handle($document);